class procedure Yield; static;
static void __fastcall Yield();
Passes the execution to another thread.
Yield notifies the system that it can pass the execution to the next scheduled thread on the current processor. The operating system will select the next thread.
Note: The method is limited to the processor that executes the calling thread.
Yield is system wide. The OS decides which thread runs, and not necessarily from the same process. All threads are scheduled based on their priority, regardless of the process. You will never get any kind of “pattern” you expect since thread scheduling is a dynamic process and is affected by all the other threads running on the system, including services and kernel threads. In fact, the OS will automatically and dynamically bump the priority of a thread if it sees that it hasn’t been scheduled in a while. This helps control thread starvation and lock-convoys. A lock-convoy can happen when a thread holds a lock longer than it takes for new tasks/threads requesting the lock to come in.