sched_yield(S)
sched_yield --
yield processor
Syntax
cc . . . -lc
#include <sched.h>
int sched_yield(void);
Description
sched_yield
forces the running process to give up the CPU
and places it on the queue of processes to run. The process will
run again when it becomes the highest priority process that can be run.
There are no arguments.
Return values
Upon successful completion sched_yield returns zero. If an error
has occurred the function returns -1, and errno is set to indicate
the error.
Diagnostics
If sched_yield terminates due to an error, it will set
errno to the following value:
[ENOSYS]-
The function is not supported.
Examples
The following example illustrates the use of the sched_yield:
struct timespec tmin;
...
if(sched_getscheduler(0) == SCHED_RR && sched_rr_get_interval(0,&tmin) == 0) {
if(tmin.tv_nsec < 80000000) { /* not enough time left on CPU */
sched_yield();
}
...
Files
/usr/lib/libc.a-
linking library
See also
sched_get_priority_max(S),
sched_getparam(S),
sched_getscheduler(S),
sched_rr_get_interval(S),
sched_setparam(S),
sched_setscheduler(S)
Standards conformance
Text reprinted and/or adapted from IEEE Std
1003.1b-1993, IEEE Standard for Information
Technology, POSIX Part 1: System Application
Program Interface (API) Amendment 1: Realtime
Extensions [C Language], copyright © 1993 by the
Institute of Electrical and Electronics Engineers, Inc. The
IEEE takes no responsibility for and will assume
no liability for damages resulting from the reader's
misinterpretation of said information resulting from the
placement and context in this publication. Information is
reproduced with the permission of the IEEE.
© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003