On Mon, 23 Feb 2015 10:08:45 +0000 Graeme Geldenhuys <mailingli...@geldenhuys.co.uk> wrote:
> Hi, > > I've recently seen some posts in Delphi groups that the preferred way is > to use TThread.Queue instead of TThread.Synchronize. > > Why is that? What are the benefits? Synchronize waits for the main thread. Queue does not. Both are executed by the main thread via CheckSynchronize. Both are useful. > I've look at FPC trunk and see we now have a Queue() implementation, and > I adjusted a simple multi-threaded GUI example app I had. But I still > don't really understand what is the benefit of Queue vs Synchronise. I > still had to create a "synchronise method" which I pass in to Queue() - > similar to what I did for Synchronize(). > > Also how is Queue() calls processed? For example to get Synchronize() to > work I had to call CheckSynchronize in my main event loop. Is this also > required for Queue() functionality? Yes. Mattias _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal