Debian Codegraph @

upstream/debian-unstable/man3/pthread_yield.3

raw
1 '\" t
2 .\" Copyright 2009, Michael Kerrisk <[email protected]>
3 .\" Copyright, the authors of the Linux man-pages project
4 .\"
5 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
6 .\"
7 .TH pthread_yield 3 2026-02-08 "Linux man-pages 6.18"
8 .SH NAME
9 pthread_yield \- yield the processor
10 .SH LIBRARY
11 POSIX threads library
12 .RI ( libpthread ,\~ \-lpthread )
13 .SH SYNOPSIS
14 .nf
15 .BR "#define _GNU_SOURCE" " /* See feature_test_macros(7) */"
16 .B #include <pthread.h>
17 .P
18 .B [[deprecated]] int pthread_yield(void);
19 .fi
20 .SH DESCRIPTION
21 .BR Note :
22 This function is deprecated;
23 see below.
24 .P
25 .BR pthread_yield ()
26 causes the calling thread to relinquish the CPU.
27 The thread is placed at the end of the run queue for its static
28 priority and another thread is scheduled to run.
29 For further details, see
30 .BR sched_yield (2)
31 .SH RETURN VALUE
32 On success,
33 .BR pthread_yield ()
34 returns 0;
35 on error, it returns an error number.
36 .SH ERRORS
37 On Linux, this call always succeeds
38 (but portable and future-proof applications should nevertheless
39 handle a possible error return).
40 .SH ATTRIBUTES
41 For an explanation of the terms used in this section, see
42 .BR attributes (7).
43 .TS
44 allbox;
45 lbx lb lb
46 l l l.
47 Interface Attribute Value
48 T{
49 .na
50 .nh
51 .BR pthread_yield ()
52 T} Thread safety MT-Safe
53 .TE
54 .SH VERSIONS
55 On Linux, this function is implemented as a call to
56 .BR sched_yield (2).
57 .SH STANDARDS
58 None.
59 .SH HISTORY
60 .\" BSD, Tru64, AIX, and Irix.
61 Deprecated since glibc 2.34.
62 Use the standardized
63 .BR sched_yield (2)
64 instead.
65 .SH NOTES
66 .BR pthread_yield ()
67 is intended for use with real-time scheduling policies (i.e.,
68 .B SCHED_FIFO
69 or
70 .BR SCHED_RR ).
71 Use of
72 .BR pthread_yield ()
73 with nondeterministic scheduling policies such as
74 .B SCHED_OTHER
75 is unspecified and very likely means your application design is broken.
76 .SH SEE ALSO
77 .BR sched_yield (2),
78 .\" FIXME . .BR pthread_cond_wait (3),
79 .BR pthreads (7),
80 .BR sched (7)