'\" t .\" Title: yield .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.78.1 .\" Date: May 2018 .\" Manual: Driver Basics .\" Source: Kernel Hackers Manual 3.16.56 .\" Language: English .\" .TH "YIELD" "9" "May 2018" "Kernel Hackers Manual 3\&.16\&" "Driver Basics" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .\" http://bugs.debian.org/507673 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) .ad l .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- .SH "NAME" yield \- yield the current processor to other threads\&. .SH "SYNOPSIS" .HP \w'void\ __sched\ yield('u .BI "void __sched yield(" "void" ");" .SH "ARGUMENTS" .PP \fIvoid\fR .RS 4 no arguments .RE .SH "DESCRIPTION" .PP .PP Do not ever use this function, there\*(Aqs a 99% chance you\*(Aqre doing it wrong\&. .PP The scheduler is at all times free to pick the calling task as the most eligible task to run, if removing the \fByield\fR call from your code breaks it, its already broken\&. .SH "TYPICAL BROKEN USAGE IS" .PP .PP while (!event) \fByield\fR; .PP where one assumes that \fByield\fR will let \*(Aqthe other\*(Aq process run that will make event true\&. If the current task is a SCHED_FIFO task that will never happen\&. Never use \fByield\fR as a progress guarantee!! .PP If you want to use \fByield\fR to wait for something, use \fBwait_event\fR\&. If you want to use \fByield\fR to be \*(Aqnice\*(Aq for others, use \fBcond_resched\fR\&. If you still want to use \fByield\fR, do not! .SH "COPYRIGHT" .br