1 .\" $NetBSD: _lwp_park.2,v 1.9 2014/01/31 21:11:05 wiz 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.
35 .Nd wait interruptably in the kernel
41 .Fn _lwp_park "clockid_t clock_id" "int flags" "const struct timespec *ts" "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:
54 and the time it specifies has passed.
57 time can be an relative interval to wait if the
59 argument does not contain
61 or it can be an absolute time compared to
65 depending on the value
70 The LWP receives a directed signal posted using
72 or is elected to handle a signal on behalf of its containing process.
74 The LWP is awoken by another LWP in the same process that has made
78 The LWP is awoken by another LWP in the same process that has made
85 The preferred method to awaken an LWP sleeping as a result of a call
94 system call is a more general facility, and requires more resources
99 argument specifies the address of object upon which the LWP is
103 value is matched between calls to
108 .Fn _lwp_unpark_all ,
109 it may reduce the time necessary for the system to resume execution
116 arguments can be used to fold a park operation and unpark operation into a
120 is non-zero, the system will behave as if the following call had been made
121 before the calling thread begins to wait:
123 _lwp_unpark(unpark, unparkhint);
127 may return a value of 0.
128 Otherwise, \-1 is returned and
130 is set to provide more information.
132 .Bl -tag -width [EINVAL]
134 A request was made to wake the LWP before it began to wait in
137 The LWP has been awoken by a signal or by a call to one of the
140 .Fn _lwp_unpark_all ,
143 The time value specified by
147 No LWP can be found in the current process corresponding to
150 The UTC time specified by
156 .Xr _lwp_unpark_all 2 ,
161 system call first appeared in