NAME
_lwp_wait - wait for a 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(), then
_lwp_wait() returns immediately. If wait_for is NULL, then
_lwp_wait() waits for any undetached LWP in the current pro-
cess. If wait_for is not NULL, then it must specify an unde-
tached LWP in the current process. If departed_lwp is not
NULL, then it points to 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 this
process waiting for this specific LWP to exit, then one of
the waiting LWPs is unblocked and it returns from
_lwp_wait() successfully. Any other LWPs waiting for this
same LWP to exit are also unblocked, however, they return
from _lwp_wait() with an error (ESRCH) indicating the waited
for LWP no longer exists. If there are no LWPs in this pro-
cess waiting for this specific LWP to exit but there are
one or more LWPs waiting for any LWP to exit, then one of
the waiting LWPs is unblocked and it returns from
_lwp_wait() successfully.
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 are detected, _lwp_wait()
fails and returns the corresponding value:
EINTR The _lwp_wait() function was interrupted by a signal.
EDEADLK
All LWPs in this process would be blocked waiting for
LWPs to terminate, or the calling LWP is attempting to
wait for itself.
If any of the following conditions occur, _lwp_wait() fails
and returns the corresponding value:
ESRCH The wait_for argument cannot be found in the current
process or it was detached.
SEE ALSO
_lwp_create(2), _lwp_exit(2)
|
Закладки на сайте Проследить за страницей |
Created 1996-2025 by Maxim Chirkov Добавить, Поддержать, Вебмастеру |