[fpc-pascal] Correct way for using TThread.ForceQueue?

Mattias Gaertner nc-gaertnma at netcologne.de
Mon Apr 25 16:12:40 CEST 2022

On Mon, 25 Apr 2022 15:47:57 +0200
Thomas Kurz via fpc-pascal <fpc-pascal at lists.freepascal.org> wrote:

> As far as I have seen so far, the common solution is to use a
> variable inside the class to cache the parameters, then to use a
> DoCallSync procedure which takes no parameters but can use the cached
> values inside, and finally to call TThread.Synchronize(NIL,
> @DoCallSync). I have stick to this concept when using Synchronize,
> too.

Or some small class:

  TMyData = class 
    a: whatever;
    procedure Run;

TThread.Synchronize(NIL, @MyData.Run).

Free MyData when done and/or in the destructor.



More information about the fpc-pascal mailing list