Forum > FPC development

[Thread] Future Request, Passing object parameter with Synchronizeor Queue

(1/1)

Zaher:
According to this article

We need to use anonymous procedure to pass parameter to main thread, but while that not exists in FPC right now (not sure I tested FPC3.1.1)

Why not adding another param  to synchronize/queue with procedure pointer, another pointer/object, to pass it to the procedure when call it.

procedure MyProc(AObject: TObject);

in the thread
Synchronize(MyProc, MyObject);

marcov:
It would be delphi incompatible, and only complicate matters once anonymous methods is done.

I myself still use the same scheme I used during D7, a pool of objects and a queue, and then synchronize draining the queue.

The only change is that generics it is easier to instantiate them typesafe.

Zaher:
yes I know Delphi incompatible, but it will not break compatibility, FPC should have its own way, BTW yeah I don't think I will see this feature in my future :P .

I still using pool, queue too.

Navigation

[0] Message Index

Go to full version