[fpc-pascal] Use sleep in thread
mschnell at lumino.de
Wed Feb 25 16:25:12 CET 2015
On 02/25/2015 03:41 PM, Xiangrong Fang wrote:
> Can I use Sleep() in a thread to give up cpu time to other threads
> running at the same time
Sleep(n) makes the thread give up CPU for _at_least_ n milliseconds
Sleep(0) makes it give up it's current time slice and is due to be
re-scheduled rather soon.
sleep will not necessary give time to other threads. it also might give
the time to other programs running on the system.
In an SMP OS multiple threads run at the same time, anyway. Sleep might
make a thread run that before was waiting for a CPU.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the fpc-pascal