Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

_lwp_park(2) [netbsd man page]

_LWP_PARK(2)						      BSD System Calls Manual						      _LWP_PARK(2)

NAME
_lwp_park -- wait interruptably in the kernel LIBRARY
Standard C Library (libc, -lc) SYNOPSIS
#include <lwp.h> int _lwp_park(const struct timespec *abstime, lwpid_t unpark, const void *hint, const void *unparkhint); DESCRIPTION
_lwp_park() can be used to synchronize access to resources among multiple light-weight processes. It causes the calling LWP to wait inter- ruptably in the kernel, until one of the following conditions is met: o The abstime argument is non-NULL, and the absolute UTC time it specifies has passed. o The LWP receives a directed signal posted using _lwp_kill(), or is elected to handle a signal on behalf of its containing process. o The LWP is awoken by another LWP in the same process that has made a call to _lwp_wakeup(). o The LWP is awoken by another LWP in the same process that has made a call to _lwp_unpark() or _lwp_unpark_all(). The preferred method to awaken an LWP sleeping as a result of a call to _lwp_park() is to make a call to _lwp_unpark(), or _lwp_unpark_all(). The _lwp_wakeup() system call is a more general facility, and requires more resources to execute. The optional hint argument specifies the address of object upon which the LWP is synchronizing. When the hint value is matched between calls to _lwp_park() and _lwp_unpark() or _lwp_unpark_all(), it may reduce the time necessary for the system to resume execution of waiting LWPs. The unpark and unparkhint arguments can be used to fold a park operation and unpark operation into a single system call. If unpark is non- zero, the system will behave as if the following call had been made before the calling thread begins to wait: _lwp_unpark(unpark, unparkhint); RETURN VALUES
_lwp_park() may return a value of 0. Otherwise, -1 is returned and errno is set to provide more information. ERRORS
[EALREADY] A request was made to wake the LWP before it began to wait in the kernel. [EINTR] The LWP has been awoken by a signal or by a call to one of the following functions: _lwp_unpark(), _lwp_unpark_all(), _lwp_wakeup(). [EINVAL] The time value specified by abstime is invalid. [ESRCH] No LWP can be found in the current process corresponding to unpark. [ETIMEDOUT] The UTC time specified by abstime has passed. SEE ALSO
_lwp_unpark(2), _lwp_unpark_all(2), _lwp_wakeup(2) HISTORY
The _lwp_park() system call first appeared in NetBSD 5.0. BSD
September 25, 2007 BSD

Check Out this Related Man Page

ttrace_wait(2)							System Calls Manual						    ttrace_wait(2)

NAME
ttrace_wait - wait for ttrace event SYNOPSIS
DESCRIPTION
The system call provides a means to wait for a event to occur. A tracing process (debugger) will normally invoke after a process or any of its threads has been set running. synchronizes tracing requests directed at threads within the traced process. This mechanism differs from the process-oriented synchroniza- tion provided by or (see wait(2)). The pid argument identifies the process-id of a traced process which the debugger expects to stop. If pid is a positive value, and lwpid is zero, then will wait for any thread in the traced process identified by pid to stop in response to an outstanding ttrace event. The information concerning the thread that hit the event point is available in the ttstate_t structure (see ttrace(2)). The lwpid argument identifies the Lightweight Process (LWP) id of a thread in the traced process pid for which the debugger must wait to validate request completion. If both pid and lwpid are non-zero values, suspends the calling process until the specified LWP in the traced process stops. When multiple child processes are simultaneously traced, can be used to identify the process-id and LWP id of a thread which stopped in response to any outstanding request established for the group of traced child processes. This is achieved by invoking with both pid and lwpid set to 0 (zero). A zero pid and non-zero lwpid will return an error. The option argument must specify either or These values control the synchronizing effect of on the calling process. The value causes to behave in non-blocking mode and return to the calling process immediately whether or not a pre-existing ttrace request completed on behalf of the tracing process. With suspends the calling process until the requested pid and/or LWP stop. As mentioned above, the tsp argument references a ttstate_t structure (see ttrace(2)) which provides all the needed information regarding the stopped thread. The size argument specifies the size of the ttstate_t structure referenced by addr. RETURN VALUE
If the call succeeds, will return 1 (one) if the event was never waited for, 0 (zero) otherwise. If the call fails, -1 is returned and is set to the appropriate value. ERRORS
The system call fails if one or more of the following is true: [EINVAL] pid is zero and lwpid is non-zero. [EINVAL] The option is invalid. [EINVAL] The lwpid is not controlled by process pid. [ESRCH] The pid or lwpid do not identify an existing process (LWP). [EACCES] The pid does not identify a process debugged by the invoking process. [ECHILD] The process (LWP) died while it was waited for. [EINTR] was interrupted by a signal. [EFAULT] An invalid address was given for the kernel to write data into. AUTHOR
was developed by HP. SEE ALSO
ttrace(2), wait(2). ttrace_wait(2)
Man Page