[fpc-pascal] Use sleep in thread

Xiangrong Fang xrfang at gmail.com
Thu Feb 26 14:23:33 CET 2015

2015-02-26 18:50 GMT+08:00 Henry Vermaak <henry.vermaak at gmail.com>:

> >
> > Sleep is for granting the CPU for other processes for (at least) a
> > predefined time.
> >
> > See the mail of the original poster: this is what he asked for.
​Thats ri​ght.

> This is incorrect, since if you pause a thread with sleep(), you'll have
> to loop to check when you're supposed to wake up.

​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.

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?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20150226/040193f2/attachment.html>

More information about the fpc-pascal mailing list