cdew / omnithreadlibrary

Automatically exported from code.google.com/p/omnithreadlibrary
0 stars 0 forks source link

Parallel.ForEach doesn't execute OnStop delegate if there is just one core #48

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
    Parallel.ForEach( 0, High(filters) )
      .OnStop( procedure
        begin
           <...>
        end )
      .Execute( procedure(const task: IOmniTask; const Index: Integer )
        begin
           <...>
        end );

The OnStop delegate is never executed if the machine is having just one core 
and the task is always nil (I think this is by design).

I think the problem is in TOmniParallelLoopBase.InternalExecuteTask the main if 
execute the taskdelagate(nil) without executing the onstop. 

This means that a program that is running fine on a multicore machine will have 
a different behaviour on a single core machine.

Original issue reported on code.google.com by tommaso....@vizubi.com on 16 Sep 2013 at 1:29

GoogleCodeExporter commented 9 years ago
Fixed.

Original comment by gabr42 on 13 Oct 2013 at 9:16