1 .\" Copyright (c) 2016 The FreeBSD Foundation, Inc.
2 .\" All rights reserved.
4 .\" This documentation was written by
5 .\" Konstantin Belousov <kib@FreeBSD.org> under sponsorship
6 .\" from the FreeBSD Foundation.
8 .\" Redistribution and use in source and binary forms, with or without
9 .\" modification, are permitted provided that the following conditions
11 .\" 1. Redistributions of source code must retain the above copyright
12 .\" notice, this list of conditions and the following disclaimer.
13 .\" 2. Redistributions in binary form must reproduce the above copyright
14 .\" notice, this list of conditions and the following disclaimer in the
15 .\" documentation and/or other materials provided with the distribution.
17 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
18 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
21 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 .Dd September 23, 2016
36 .Nd suspend the calling thread
42 .Fn thr_suspend "struct timespec *timeout"
45 This function is intended for implementing threading.
46 Normal applications should use
47 .Xr pthread_cond_timedwait 3
49 .Xr pthread_cond_broadcast 3
50 for typical safe suspension with cooperation of the thread
52 .Xr pthread_suspend_np 3
54 .Xr pthread_resume_np 3
55 in some specific situations, instead.
60 system call puts the calling thread in a suspended state, where it is
61 not eligible for CPU time.
62 This state is exited by another thread calling
64 when the time interval specified by
67 or by the delivery of a signal to the suspended thread.
73 the suspended state can be only terminated by explicit
79 was delivered before the
81 call, the thread is not put into a suspended state.
83 returns immediately without an error.
85 If a thread previously called
87 with its own thread identifier, which resulted in setting the internal kernel
88 flag to immediately abort interruptible sleeps with an
98 called from another thread, the next
100 call does not result in suspension.
107 operation returns the following errors:
110 The memory pointed to by the
112 argument is not valid.
114 The specified timeout expired.
118 argument specified a zero time interval.
120 The sleep was interrupted by a signal.
125 .Xr pthread_resume_np 3 ,
126 .Xr pthread_suspend_np 3
130 system call is non-standard.