Yielding the processor to another thread

At times, your application can benefit if a thread yields the processor to another thread in the system.

When a thread yields the processor, the system immediately allows another active thread of equal or higher priority to run. If no threads of equal or higher priority are currently ready to run, yielding the processor has no effect. Beyond the immediate action, yielding the processor does not have any additional predictable behavior related to the scheduling of the threads in the system.

The System i® platform provides a fully preemptive multitasking scheduling algorithm. A thread that exists in a well-written application should seldom need to yield the processor to other threads. This is because more predictable application programming interfaces (APIs) for synchronizing threads are available.