DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

sched_yield(S-osr5)


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-osr5), sched_getparam(S-osr5), sched_getscheduler(S-osr5), sched_rr_get_interval(S-osr5), sched_setparam(S-osr5), sched_setscheduler(S-osr5)

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.
© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 -- 02 June 2005