1 .\" Copyright (C) Tom Bjorkholm & Markus Kuhn, 1996
3 .\" SPDX-License-Identifier: GPL-2.0-or-later
5 .\" 1996-04-01 Tom Bjorkholm <tomb@mydata.se>
6 .\" First version written
7 .\" 1996-04-10 Markus Kuhn <mskuhn@cip.informatik.uni-erlangen.de>
10 .TH SCHED_YIELD 2 2021-03-22 "Linux man-pages (unreleased)" "Linux Programmer's Manual"
12 sched_yield \- yield the processor
15 .RI ( libc ", " \-lc )
20 .B int sched_yield(void);
24 causes the calling thread to relinquish the CPU.
25 The thread is moved to the end of the queue for its static
26 priority and a new thread gets to run.
31 On error, \-1 is returned, and
33 is set to indicate the error.
35 In the Linux implementation,
39 POSIX.1-2001, POSIX.1-2008.
41 If the calling thread is the only thread in the highest
42 priority list at that time,
43 it will continue to run after a call to
46 POSIX systems on which
49 .B _POSIX_PRIORITY_SCHEDULING
55 can improve performance by giving other threads or processes
56 a chance to run when (heavily) contended resources (e.g., mutexes)
57 have been released by the caller.
60 unnecessarily or inappropriately
61 (e.g., when resources needed by other
62 schedulable threads are still held by the caller),
63 since doing so will result in unnecessary context switches,
64 which will degrade system performance.
67 is intended for use with real-time scheduling policies (i.e.,
73 with nondeterministic scheduling policies such as
75 is unspecified and very likely means your application design is broken.