Warning: main(/www/www/htdocs/style/globals.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/s/schedyield.html on line 1

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/globals.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/s/schedyield.html on line 1

Warning: main(/www/www/htdocs/style/header.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/s/schedyield.html on line 8

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/header.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/s/schedyield.html on line 8

SchedYield(), SchedYield_r()

Yield to other threads

Synopsis:

#include <sys/neutrino.h>

int SchedYield( void );

int SchedYield_r( void );

Library:

libc

Use the -l c option to qcc to link against this library. This library is usually included automatically.

Description:

These kernel calls check to see if other threads at the same priority as that of the calling thread are ready to run. If so, the calling thread yields to them and places itself at the end of the READY thread queue for that priority. SchedYield() never yields to a lower-priority thread. Higher-priority threads always force a yield the instant they become ready to run. This call has no effect with respect to threads running at priorities other than the calling thread's.

The SchedYield() and SchedYield_r() functions are identical except in the way they indicate errors. See the Returns section for details.


Note: Instead of using these kernel calls directly, consider calling sched_yield().

Avoid designing programs that contain busy-wait loops using SchedYield() to timeslice. If this is unavoidable, you can use SchedYield() to reduce the system load at a given priority level. Note that a program that calls SchedYield() in a tight loop will spend a great deal of time in the kernel, which will have a small effect on scheduling interrupt latency.

Blocking states

These calls don't block. However, if other threads are ready at the same priority, the calling thread is placed at the end of the ready queue for this priority.

Returns:

The only difference between these functions is the way they indicate errors:

SchedYield()
If an error occurs, -1 is returned and errno is set. Any other value returned indicates success.
SchedYield_r()
EOK is returned on success. This function does NOT set errno. If an error occurs, any value in the Errors section may be returned.

Classification:

QNX Neutrino

Safety:
Cancellation point No
Interrupt handler No
Signal handler Yes
Thread Yes

See also:

sched_yield(), SchedGet(), SchedSet()

Processes and Threads chapter of Getting Started with QNX Neutrino


Warning: main(/www/www/htdocs/style/footer.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/s/schedyield.html on line 158

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/footer.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/s/schedyield.html on line 158