On 16.05.2010 16:01, Jonas Maebe wrote: > > On 14 May 2010, at 00:18, Roland Schaefer wrote: > >> Now, instead of busy waiting in the main thread loop (even with a Sleep >> inserted), I'd rather have it idle wait until another thread needs to >> synchronize. Is that possible? > > CheckSynchronize has a parameter "timeout" with the default value 0: > http://www.freepascal.org/docs-html/rtl/classes/checksynchronize.html > > You can pass a different value to wait for a longer period of time (specify > the number of milliseconds). There is no equivalent of "wait forever" though.
Thanks a lot! Setting it sufficiently high gives me exactly what I need. One suggestion for the docs: I actually had (admittedly very quickly) tried CheckSynchronize with a timeout before. However, the procedure outclevered me, since for the test I didn't create any threads before going into a loop with CheckSynchronize(2147483647). It just didn't seem to work. Looking at classes.inc, I have now found out that it has sanity checks which make it ignore the timeout when there are no threads created. Shouldn't this be mentioned in the docs? Thanks again Roland _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal