On Thu, Feb 26, 2015 at 11:40:44AM +0100, Michael Schnell wrote: > On 02/26/2015 11:33 AM, Henry Vermaak wrote: > >Blocking with an even will sleep until someone wakes you up, it's > >very efficient. Using sleep() you will have to wake up, check if > >someone needs you, go to sleep again, etc. This is obviously more > >inefficient. > > We were talking about the overhead of a "sleep for n milliseconds" > functionality itself, and not about waiting for some event. > > Abusing it for polling of course is not what sleep is meant for. > > 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.
The message you replied to was regarding pausing a thread, let me quote you back to yourself: =============================================================================== On 02/25/2015 09:17 PM, fredvs wrote: > Hello. > > You may use RTLEvents to pause a thread. => > Obviously CPU the overhead is a lot greater than with just calling sleep. -Michael =============================================================================== 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. _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal