unixdev.net


Switch to SpeakEasy.net DSL

The Modular Manual Browser

Home Page
Manual: (SunOS-5.9)
Page:
Section:
Apropos / Subsearch:
optional field



System Calls                                         _lwp_wait(2)



NAME
     _lwp_wait - wait for an LWP to terminate

SYNOPSIS
     #include <sys/lwp.h>

     int _lwp_wait(lwpid_t wait_for, lwpid_t *departed_lwp);

DESCRIPTION
     The _lwp_wait() function blocks the current  LWP  until  the
     LWP  specified  by wait_for terminates. If the specified LWP
     terminated prior to the  call  to  _lwp_wait(),  _lwp_wait()
     returns immediately.  If wait_for is zero, _lwp_wait() waits
     for any undetached LWP in the current process.  If  wait_for
     is  not  zero,  it  must  specify  an  undetached LWP in the
     current process. If departed_lwp is not NULL, it points to a
     location  where  the  ID  of  the  exited LWP is stored (see
     _lwp_exit(2)).

     When an LWP exits and there are one or more LWPs in the pro-
     cess waiting for this specific LWP to exit, one of the wait-
     ing LWPs is unblocked and it returns from  _lwp_wait()  suc-
     cessfully.  Any other LWPs waiting for this same LWP to exit
     are also unblocked, but they return from _lwp_wait() with an
     error  (ESRCH)  indicating  the  waited-for  LWP  no  longer
     exists. If there are no LWPs in the process waiting for this
     specific LWP  to exit but there are one or more LWPs waiting
     for any LWP to exit, one of the waiting  LWPs  is  unblocked
     and it returns from _lwp_wait() successfully.

     If an LWP is waiting for any LWP to exit, it blocks until an
     undetached LWP for which no other LWP is waiting terminates,
     at which time it returns successfully, or  until  all  other
     LWPs  in  the process are either daemon LWPs or LWPs waiting
     in _lwp_wait(), in which case it returns EDEADLK.

     The ID  of  an  LWP  that  has  exited  may  be  reused  via
     _lwp_create()  after  the  LWP  has been successfully waited
     for.

RETURN VALUES
     Upon successful completion, 0 is returned. A non-zero  value
     indicates an error.

ERRORS
     If any of the following conditions occur, _lwp_wait()  fails
     and returns the corresponding value:

     EDEADLK
           A wait deadlock was detected,  such  as  when  an  LWP
           attempts  to  wait  for  itself, or the calling LWP is
           waiting for any LWP to exit and only  daemon  LWPs  or



SunOS 5.9           Last change: 29 Jan 2003                    1






System Calls                                         _lwp_wait(2)



           waiting LWPs exist in the process.

     EINTR The _lwp_wait() function was interrupted by a signal.

     EINVAL
           The LWP  with  the  ID  specified  by  wait_for  is  a
           detached LWP.

     ESRCH No LWP with the ID specified by wait_for can be  found
           in the current process.

ATTRIBUTES
     See attributes(5)  for descriptions of the following  attri-
     butes:

     ____________________________________________________________
    |       ATTRIBUTE TYPE        |       ATTRIBUTE VALUE       |
    |_____________________________|_____________________________|
    | Interface Stability         | Obsolete                    |
    |_____________________________|_____________________________|
    | MT-Level                    | Async-Signal-Safe           |
    |_____________________________|_____________________________|


SEE ALSO
     _lwp_create(2), _lwp_detach(2), _lwp_exit(2), attributes(5)

NOTES
     The _lwp_wait() function is obsolete and will be removed  in
     a future release.

























SunOS 5.9           Last change: 29 Jan 2003                    2