[fpc-pascal] Use sleep in thread

Xiangrong Fang xrfang at gmail.com
Wed Feb 25 16:33:00 CET 2015


2015-02-25 23:16 GMT+08:00 <hinstance at yandex.ru>:

> not sure if this helps, but:
> for example, if you want thread T to run using approx. 70% of max.
> available capacity, try this:
>
> repeat
>   T.Resume;
>   Sleep(70);
>   T.Resume;
>   Sleep(30);
> until ...
>

‚ÄčThis seems not what I want. I would like to schedule it from within the
thread.  My demo program is here:

https://github.com/xrfang/fpcollection/blob/master/src/demos/asyncdo/demo.lpr

TAsyncDo is the class I wrote to have a procedure run in parallel.

I want to control priority of the thread from within the worker, not from
the main thread. ‚Äč
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20150225/c882c5f1/attachment.html>


More information about the fpc-pascal mailing list