<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">On 02/25/2015 03:41 PM, Xiangrong Fang
wrote:<br>
</div>
<blockquote
cite="mid:CAP93jB2t2CK096fV3Fi65RvTcyHjRiX1hfjf4=hjH=c-FhyLkw@mail.gmail.com"
type="cite">
<div dir="ltr"><br>
<div class="gmail_default"
style="font-family:monospace,monospace;font-size:large">Can I
use Sleep() in a thread to give up cpu time to other threads
running at the same time<br>
</div>
</div>
</blockquote>
AFAIK: <br>
<br>
Sleep(n) makes the thread give up CPU for _at_least_ n milliseconds<br>
<br>
Sleep(0) makes it give up it's current time slice and is due to be
re-scheduled rather soon.<br>
<br>
sleep will not necessary give time to other threads. it also might
give the time to other programs running on the system.<br>
<br>
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.<br>
<br>
-Michael<br>
</body>
</html>