<div dir="ltr"><div class="gmail_default" style="font-family:monospace,monospace;font-size:large"><span style="font-family:arial,sans-serif;font-size:small">2015-02-26 18:50 GMT+08:00 Henry Vermaak </span><span dir="ltr" style="font-family:arial,sans-serif;font-size:small"><<a href="mailto:henry.vermaak@gmail.com" target="_blank">henry.vermaak@gmail.com</a>></span><span style="font-family:arial,sans-serif;font-size:small">:</span><br></div><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span>><br>
> Sleep is for granting the CPU for other processes for (at least) a<br>
> predefined time.<br>
><br>
> See the mail of the original poster: this is what he asked for.<br>
<br></span></blockquote><div><br></div><div><div class="gmail_default" style="font-family:monospace,monospace;font-size:large">​Thats ri​ght.</div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
This is incorrect, since if you pause a thread with sleep(), you'll have<br>
to loop to check when you're supposed to wake up.<br>
<div><div><div class="gmail_default" style="font-family:monospace,monospace;font-size:large"><span style="font-family:arial,sans-serif;font-size:small;color:rgb(34,34,34)"></span></div></div></div></blockquote><div><br></div><div><div class="gmail_default" style="font-family:monospace,monospace;font-size:large;display:inline">​I use rtlevent, but only meant to maintain a pool of threads, while there is no task for a thread it is blocked waiting for an event.</div></div><div><div class="gmail_default" style="font-family:monospace,monospace;font-size:large;display:inline"><br></div></div><div><div class="gmail_default" style="font-family:monospace,monospace;font-size:large;display:inline">BUT, that cannot be used to prioritize a thread. While you block a thread using rtlevent, it can only be unblocked from another thread. While you use sleep(), it still get time share of the CPU, only that it does nothing until sleep finishes, right?  That way, it only consume a tiny amount of computing power while sleeping. This, in my view, is the price I have to pay to achieve my purpose?</div></div></div></div></div>