1PTHREAD_YIELD(3)           Linux Programmer's Manual          PTHREAD_YIELD(3)
2
3
4

NAME

6       pthread_yield - yield the processor
7

SYNOPSIS

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

DESCRIPTION

17       Note: This function is deprecated; see below.
18
19       pthread_yield()  causes  the calling thread to relinquish the CPU.  The
20       thread is placed at the end of the run queue for  its  static  priority
21       and  another  thread  is  scheduled  to  run.  For further details, see
22       sched_yield(2)
23

RETURN VALUE

25       On success, pthread_yield() returns 0; on error, it  returns  an  error
26       number.
27

ERRORS

29       On  Linux, this call always succeeds (but portable and future-proof ap‐
30       plications should nevertheless handle a possible error return).
31

VERSIONS

33       Since glibc 2.34, this function is marked as deprecated.
34

ATTRIBUTES

36       For an  explanation  of  the  terms  used  in  this  section,  see  at‐
37       tributes(7).
38
39       ┌────────────────────────────────────────────┬───────────────┬─────────┐
40Interface                                   Attribute     Value   
41       ├────────────────────────────────────────────┼───────────────┼─────────┤
42pthread_yield()                             │ Thread safety │ MT-Safe │
43       └────────────────────────────────────────────┴───────────────┴─────────┘
44

CONFORMING TO

46       This  call  is  nonstandard, but present on several other systems.  Use
47       the standardized sched_yield(2) instead.
48

NOTES

50       On Linux, this function is implemented as a call to sched_yield(2).
51
52       pthread_yield() is intended for use with real-time scheduling  policies
53       (i.e.,  SCHED_FIFO or SCHED_RR).  Use of pthread_yield() with nondeter‐
54       ministic scheduling policies such as  SCHED_OTHER  is  unspecified  and
55       very likely means your application design is broken.
56

SEE ALSO

58       sched_yield(2), pthreads(7), sched(7)
59

COLOPHON

61       This  page  is  part of release 5.13 of the Linux man-pages project.  A
62       description of the project, information about reporting bugs,  and  the
63       latest     version     of     this    page,    can    be    found    at
64       https://www.kernel.org/doc/man-pages/.
65
66
67
68Linux                             2021-03-22                  PTHREAD_YIELD(3)
Impressum