[fpc-pascal] Use sleep in thread
Michael Schnell
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
AFAIK:
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.
-Michael
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20150225/56dbf7fb/attachment.html>
More information about the fpc-pascal
mailing list