1 .\" $NetBSD: _lwp_park.2,v 1.7 2008/04/30 13:10:51 martin Exp $
3 .\" Copyright (c) 2003, 2007 The NetBSD Foundation, Inc.
4 .\" All rights reserved.
6 .\" This code is derived from software contributed to The NetBSD Foundation
7 .\" by Jason R. Thorpe of Wasabi Systems, Inc, and by Andrew Doran.
9 .\" Redistribution and use in source and binary forms, with or without
10 .\" modification, are permitted provided that the following conditions
12 .\" 1. Redistributions of source code must retain the above copyright
13 .\" notice, this list of conditions and the following disclaimer.
14 .\" 2. Redistributions in binary form must reproduce the above copyright
15 .\" notice, this list of conditions and the following disclaimer in the
16 .\" documentation and/or other materials provided with the distribution.
18 .\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
19 .\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
20 .\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21 .\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
22 .\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23 .\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24 .\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25 .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26 .\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28 .\" POSSIBILITY OF SUCH DAMAGE.
30 .Dd September 25, 2007
35 .Nd wait interruptably in the kernel
41 .Fn _lwp_park "const struct timespec *abstime" "lwpid_t unpark" "const void *hint" "const void *unparkhint"
44 can be used to synchronize access to resources among multiple light-weight
46 It causes the calling LWP to wait interruptably in the kernel, until one
47 of the following conditions is met:
52 argument is non-NULL, and the absolute UTC time it specifies has passed.
54 The LWP receives a directed signal posted using
56 or is elected to handle a signal on behalf of its containing process.
58 The LWP is awoken by another LWP in the same process that has made
62 The LWP is awoken by another LWP in the same process that has made
69 The preferred method to awaken an LWP sleeping as a result of a call
78 system call is a more general facility, and requires more resources
83 argument specifies the address of object upon which the LWP is
87 value is matched between calls to
93 it may reduce the time necessary for the system to resume execution
100 arguments can be used to fold a park operation and unpark operation into a
104 is non-zero, the system will behave as if the following call had been made
105 before the calling thread begins to wait:
107 _lwp_unpark(unpark, unparkhint);
111 may return a value of 0.
112 Otherwise, \-1 is returned and
114 is set to provide more information.
116 .Bl -tag -width [EINVAL]
118 A request was made to wake the LWP before it began to wait in
121 The LWP has been awoken by a signal or by a call to one of the
124 .Fn _lwp_unpark_all ,
127 The time value specified by
131 No LWP can be found in the current process corresponding to
134 The UTC time specified by
140 .Xr _lwp_unpark_all 2 ,
145 system call first appeared in