In Windows 3.11 and in earlier MacOS versions, there is no preemptive multitasking where the OS takes away the CPU from your process to give other processes a chance to run. So if you don’t do anything, as soon as your process starts running, all other processes stop until your process is finished.
Here comes the Yield () function. It calls the OS and tells it to let other processes run. So you lose the CPU, and some other process gets it, until it calls Yield() itself. Eventually you get the CPU back and your call to Yield() returns.
If you check your clock, thr call to Yield may have taken any time from microseconds to many seconds, but it takes zero CPU time.
You need to be careful about how often you call yieldYield. If you set a million numbers in an array to 0 and Yield() after each number, you waste the overhead of a million yield calls. If you call yieldYield every 10 seconds while running some code for an hour, that is very rude because all the other processes are starved of CPU time. So this makes your application look good but end users hate you.
Note that if you have an event loop (What did the user do? Pressed a key on the keyboard? Clicked the mouse? Handle it!) the operating system will typically call Yield() for you, so while you wait for user input other processes can run. So you call Yield() yourself from time to time if user input starts a long running process.
And note that because you control at which times you lose the CPU, many more operations are atomic automatically. This is not true with preemptive multi-tasking which makes it harder to always get right.