HELPLIB.HLB  —  POSIX Threads, PTHREAD routines, sched_yield
    Yields execution to another thread.

    Syntax

      sched_yield();

1  –  C Binding

    #include <sched.h>
    #include <unistd.h>

    int
    sched_yield (void);

2  –  Arguments

    None

3  –  Description

    In conformance with the IEEE POSIX.1-1996 standard, the sched_
    yield() function causes the calling thread to yield execution
    to another thread. It is useful when a thread running under the
    SCHED_FIFO scheduling policy must allow another thread at the
    same priority to run. The thread that is interrupted by sched_
    yield() goes to the end of the queue for its priority.

    If no other thread is runnable at the priority of the calling
    thread, the calling thread continues to run.

    Threads with higher priority are allowed to preempt the calling
    thread, so the sched_yield() function has no effect on the
    scheduling of higher- or lower-priority threads.

    The sched_yield() routine takes no arguments. No special
    privileges are needed to use the sched_yield() function.

4  –  Return Values

    If an error condition occurs, this routine returns an integer
    value indicating the type of error. Possible return values are as
    follows:

    Return      Description

    0           Successful completion.
    [ENOSYS]    The routine sched_yield()  is not supported by this
                implementation.

5  –  Associated Routines

       pthread_attr_setschedparam()
       pthread_getschedparam()
       pthread_setschedparam()
Close Help