PatV 1 Posted September 5, 2019 Delphi 10.3 Omnithead 3.07.5 Hi all, I'm testing and playing with the sample 24_ConnectionPool, so in the main form I've added procedure TfrmConnectionPoolDemo.btnScheduleClick(Sender: TObject); var i : integer; Params : TParameters; begin WithParamsReset(Params); WithParam(Params,cDteFrom,'2019/01/01',dtString); WithParam(Params,cDteTo ,'2019/09/01',dtString); for i:=0 to 99 do // for testing purpose launch 100 task begin Log(Format('Creating task %d',)); CreateTask(Worker,format('%0.2d',)) .MonitorWith(OTLMonitor) .SetParameter('Params',TOmniValue.FromArray<rParameter>(Params)) .SetParameter('ProcName','prc_ProcedureToCall') .Schedule(FConnectionPool); end; end; now my question is ; how can I retreive the result of the data connection in an object and send it from task Worker to the main thread ? I was thinking about msg.msgData from IOmniMessage and retreive it through OTLMonitor or insert a TOmniTaskInvokeFunction into my Worker task What is the best way ? Thanks Patrick Share this post Link to post
Primož Gabrijelčič 223 Posted September 5, 2019 (edited) Just use any of the mechanisms for sending data to the main thread (Task.Comm.Send, Task.Invoke). Or standard Delphi mechanisms (TThread.Queue). Or am I missing something? Edited September 5, 2019 by Primož Gabrijelčič Share this post Link to post
PatV 1 Posted September 5, 2019 Thanks again Primoz for your fast answer, I'll go with task.Comm.Send Regards Patrick Share this post Link to post