[fpc-pascal] TThread.Queue vs TThread.Synchronize
Marco van de Voort
marcov at stack.nl
Tue Feb 24 16:38:23 CET 2015
In our previous episode, Michael Schnell said:
> On this behalf, "Application.QueuAsyncCall" is more versatile.
> But it's easy with TThread.Queue, as well.
> - define a class (not to be derived from TThread) that holds the data
> to be transferred and a procedure without parameters
> - create an instance of that class
(where to store that instance?)
> - use TThread.Queue to have the said procedure be executed by the main
> - at the end of the said procedure do "free" (without a prefix) this
> will make the instance remoce itself.
You need a full queue for that, since the mainthread might not run till the
thread next queue()'s.
I've a simple generic threadsafe queue that I use for that.
More information about the fpc-pascal