Re: [fpc-pascal] Main thread wait and CheckSynchronize

2010-05-17 Thread Brad Campbell
Jonas Maebe wrote: On 17 May 2010, at 16:00, Brad Campbell wrote: 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

Re: [fpc-pascal] Main thread wait and CheckSynchronize

2010-05-17 Thread Jonas Maebe
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 a

Re: [fpc-pascal] Main thread wait and CheckSynchronize

2010-05-17 Thread Brad Campbell
Michael Van Canneyt wrote: Hello, 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 the

Re: [fpc-pascal] Main thread wait and CheckSynchronize

2010-05-17 Thread Michael Van Canneyt
Hello, 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. Michael. On Sun, 16 May 2010, Roland Schaefer wrote: Allow me to bump this. I'd appreciate any comments, ev

Re: [fpc-pascal] Main thread wait and CheckSynchronize

2010-05-16 Thread Roland Schaefer
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? > > CheckSynchroniz

Re: [fpc-pascal] Main thread wait and CheckSynchronize

2010-05-16 Thread Jonas Maebe
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:

Re: [fpc-pascal] Main thread wait and CheckSynchronize

2010-05-16 Thread Roland Schaefer
Allow me to bump this. I'd appreciate any comments, even if it's "Why on earth do you want to do that!?" or something. Thanks Roland On 14.05.2010 00:18, Roland Schaefer wrote: > Hello, > > I have a seemingly simple question which nevertheless is giving me > headaches: I have a main thread which

[fpc-pascal] Main thread wait and CheckSynchronize

2010-05-13 Thread Roland Schaefer
Hello, I have a seemingly simple question which nevertheless is giving me headaches: I have a main thread which does nothing but [1] execute CheckSynchronize, then [2] check whether some other things have to be done as a result of the synchronization (and do those things if necessary), then go bac