Wait for the thread scheduler to allocate CPU time slices to you later. But calling the yield method is just a suggestion, telling the thread scheduler that my work is almost done and that other threads of the same priority can use the CPU. There is no mechanism to guarantee adoption.
Yield is not sure to give up the CPU, and does not need to be restored, just wait for scheduling. This method is generally rarely used.
Thanks for correcting me
I misremembered
Wait for the thread scheduler to allocate CPU time slices to you later. But calling the yield method is just a suggestion, telling the thread scheduler that my work is almost done and that other threads of the same priority can use the CPU. There is no mechanism to guarantee adoption.