Table of Contents

Name

qthread_yield - release the CPU, allow other qthreads to run

Synopsis

#include <qthread/qthread.h>

void
qthread_yield(qthread_t *me);

Description

This function allows a qthread to explicitly interrupt computation and give other qthreads the chance to execute even though it has not blocked. This can be useful for things like busy-waits or cooperative multitasking. Without using this function, there is no guarantee that other qthreads will have a chance to execute until the currently running qthread performs a synchronization operation.

The argument, me, should be a pointer to the qthread_t structure for the currently running qthread, or NULL. If me is NULL, the qthread_t pointer will be looked up via qthread_self(). If this function is called from a non-qthread or before the qthread_init() has been run, it does nothing.

See Also

qthread_self(3)


Table of Contents