Jump to content
David Schwartz

Parallel.Join.OnStopInvoke(...

Recommended Posts

I have this code:

 

      join := Parallel.Join
                      .NumTasks( NumThreads_spinner.Value )
                      .OnStopInvoke(  // called after EACH task completes
                         procedure
                         begin
                           doSomething;
                         end
                       )
                      .TaskConfig(
                         Parallel.TaskConfig.OnTerminated(  // called when ALL tasks have completed
                           procedure (const task: IOmniTaskControl)
                           begin
                             doSomethingElse;
                           end
                         )
                       );

The OnStopInvoke method only takes a TProc parameter.

 

However, Parallel.TaskConfig.OnTerminated takes both a TProc and a procedure (const task: IOmniTaskControl).

 

This seems sort of backwards, because the first one operates on a single task, while the second one is the entire list of tasks. (What task is being passed to OnTerminated? The last one what finished up?)

 

Anyway, my question is ... how can I get the OnStopInvoke proc to know which task just finished?

 

 

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
×