1PTHREAD_YIELD(3) Linux Programmer's Manual PTHREAD_YIELD(3)
2
3
4
6 pthread_yield - yield the processor
7
9 #define _GNU_SOURCE /* See feature_test_macros(7) */
10 #include <pthread.h>
11
12 int pthread_yield(void);
13
14 Compile and link with -pthread.
15
17 pthread_yield() causes the calling thread to relinquish the CPU. The
18 thread is placed at the end of the run queue for its static priority
19 and another thread is scheduled to run. For further details, see
20 sched_yield(2)
21
23 On success, pthread_yield() returns 0; on error, it returns an error
24 number.
25
27 On Linux, this call always succeeds (but portable and future-proof
28 applications should nevertheless handle a possible error return).
29
31 For an explanation of the terms used in this section, see
32 attributes(7).
33
34 ┌────────────────┬───────────────┬─────────┐
35 │Interface │ Attribute │ Value │
36 ├────────────────┼───────────────┼─────────┤
37 │pthread_yield() │ Thread safety │ MT-Safe │
38 └────────────────┴───────────────┴─────────┘
40 This call is nonstandard, but present on several other systems. Use
41 the standardized sched_yield(2) instead.
42
44 On Linux, this function is implemented as a call to sched_yield(2).
45
46 pthread_yield() is intended for use with real-time scheduling policies
47 (i.e., SCHED_FIFO or SCHED_RR). Use of pthread_yield() with nondeter‐
48 ministic scheduling policies such as SCHED_OTHER is unspecified and
49 very likely means your application design is broken.
50
52 sched_yield(2), pthreads(7), sched(7)
53
55 This page is part of release 4.15 of the Linux man-pages project. A
56 description of the project, information about reporting bugs, and the
57 latest version of this page, can be found at
58 https://www.kernel.org/doc/man-pages/.
59
60
61
62Linux 2017-11-26 PTHREAD_YIELD(3)