[fpc-pascal] Main thread wait and CheckSynchronize

Jonas Maebe jonas.maebe at elis.ugent.be
Mon May 17 16:14:39 CEST 2010

On 17 May 2010, at 16:00, Brad Campbell wrote:

> Michael Van Canneyt wrote:
>> I think that what you did is the only right solution. Synchronizing
>> threads is tricky, and the default mechanism is meant for GUI apps  
>> where the main thread is the GUI thread.
> I wish there was a way for a thread to asynchronously notify the  
> main thread there is a Synchronize() pending. On Linux I can insert  
> an fd() for a pipe into the gtk event loop and poke data into the  
> pipe from the thread. It's incredibly efficient and saves all the  
> waiting and polling. I've not worked out how to do this on OSX or  
> Win32 yet though.

If you use the timeout parameter from CheckSynchronize, you do get  
that effect (if you pass high(longint) as timeout, then you only  
"poll" if nothing happened for 2^31 miliseconds, which is about 24  


More information about the fpc-pascal mailing list