Jump to content
Sign in to follow this  
abluka

Hello any snippet exists about userdata in task

Recommended Posts

Hello,

 

I have a problem with userdata feature omnithread task i can set when i want to create task

 

like that

 

idxdata := tstringlist.Create;
idxdata.Add('aaa');
for n := 0 to 9 do begin
    OTLMonitors[n] := TOmniEventMonitor.create(self);
    OTLMonitors[n].OnTaskMessage := OTLMonitorTaskMessage;
    OTLMonitors[n].OnTaskTerminated := OTLMonitorTaskTerminated;
    FTasks[n] := CreateTask(TaskProcedure,'Task ' + Char(n + ord('A')) + ': ')
    .SetParameter('param','val1')
    .SetUserData(1,idxdata)
      .MonitorWith(OTLMonitors[n])
      .Run;
  end;

 

but I can't find any example or code how can I use in task procedure.

 

My procedure snippet is this.

 

procedure TaskProcedure(const task: IOmniTask);
var
  comm: IOmniCommunicationEndpoint;
  n   : cardinal;
begin
  comm := task.Comm;
//showmessage(task.Param['param']);
//showmessage(form1.Memo1.Lines[5]);

end;

 

could you help me?

 

best regards.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  
×