Jump to content

abluka

Members
  • Content Count

    1
  • Joined

  • Last visited

Posts posted by abluka


  1. 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.

×