Download Now

    Reference TThreadRunner<T>

    Declared in Codebot.Support.pas on line 80

    TThreadRunner<T> runs OnExecute on a background thread with a set of parameters, then runs OnComplete on the main thread
      TThreadRunner<T> = class(TThread)
      public
        type
        { TRunnerProc is the signature of the execute and complete procedures }
        TRunnerProc = procedure(var Params: T; Task: IAsyncTask);
      protected
        { Invokes OnComplete on the main thread }
        procedure Complete;
        { Invokes OnExecute on the background thread }
        procedure Execute; override;
      public
        { Create and start a thread runner }
        constructor Create(const Params: T; Task: IAsyncTask; OnExecute, OnComplete: TRunnerProc);
      end;

    See also

    IAsyncTask in Codebot.System.pas