Recent

Author Topic: [Thread] Future Request, Passing object parameter with Synchronizeor Queue  (Read 1944 times)

Zaher

  • Hero Member
  • *****
  • Posts: 679
    • parmaja.org
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

  • Administrator
  • Hero Member
  • *
  • Posts: 11383
  • FPC developer.
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

  • Hero Member
  • *****
  • Posts: 679
    • parmaja.org
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.

 

TinyPortal © 2005-2018