1pthread_yield(3)           Library Functions Manual           pthread_yield(3)
2
3
4

NAME

6       pthread_yield - yield the processor
7

LIBRARY

9       POSIX threads library (libpthread, -lpthread)
10

SYNOPSIS

12       #define _GNU_SOURCE             /* See feature_test_macros(7) */
13       #include <pthread.h>
14
15       [[deprecated]] int pthread_yield(void);
16

DESCRIPTION

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

RETURN VALUE

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

ERRORS

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

ATTRIBUTES

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

VERSIONS

44       On Linux, this function is implemented as a call to sched_yield(2).
45

STANDARDS

47       None.
48

HISTORY

50       Deprecated  since  glibc  2.34.   Use  the  standardized sched_yield(2)
51       instead.
52

NOTES

54       pthread_yield() is intended for use with real-time scheduling  policies
55       (i.e.,   SCHED_FIFO   or   SCHED_RR).    Use  of  pthread_yield()  with
56       nondeterministic scheduling policies such as SCHED_OTHER is unspecified
57       and very likely means your application design is broken.
58

SEE ALSO

60       sched_yield(2), pthreads(7), sched(7)
61
62
63
64Linux man-pages 6.05              2023-07-20                  pthread_yield(3)
Impressum