Information request on socket libraries - Linux

This is a discussion on Information request on socket libraries - Linux ; Hi All, Information wanted for the socket libraries.I am going to use accept() and select() system call in an multithreaded environment.Do I need to take care of any locking mechanism when I access the above calls or I can call ...

+ Reply to Thread
Results 1 to 3 of 3

Thread: Information request on socket libraries

  1. Information request on socket libraries

    Hi All,
    Information wanted for the socket libraries.I am going to use accept()
    and select() system call in an multithreaded environment.Do I need to
    take care of any locking mechanism when I access the above calls or I
    can call them directly.

    I did some google search it seems the above system calls are thread
    safe, but any help or suggestion would be very much appreciated.Do I
    need to take care of anything important if the code is ported both in
    Solaris and Linux.
    Thanks in advance.
    Regards
    Arnab

  2. Re: Information request on socket libraries

    arnab writes:
    > Information wanted for the socket libraries.I am going to use accept()
    > and select() system call in an multithreaded environment.Do I need to
    > take care of any locking mechanism when I access the above calls or I
    > can call them directly.
    >
    > I did some google search it seems the above system calls are thread
    > safe,


    The UNIX(*)-specification demands that they are thread-safe.

  3. Re: Information request on socket libraries

    On Aug 6, 8:21*am, arnab wrote:
    > Hi All,
    > Information wanted for the socket libraries.I am going to use accept()
    > and select() system call in an multithreaded environment.Do I need to
    > take care of any locking mechanism when I access the above calls or I
    > can call them directly.
    >
    > I did some google search it seems the above system calls are thread
    > safe, but any help or suggestion would be very much appreciated.Do I
    > need to take care of anything important if the code is ported both in
    > Solaris and Linux.


    The only issues will be with 'close'. Just like any other system
    resource, you must not release a resource in one thread while another
    thread is or might be using it. Otherwise, they are completely thread
    safe.

    DS

+ Reply to Thread