On Fri, 20 Aug 2010 15:15:34 +0300
"Juha Manninen (gmail)" <[email protected]> wrote:

> Hi
> 
> I tried multithreadprocs package, explained in wiki:
>  http://wiki.lazarus.freepascal.org/Parallel_procedures
> 
> I works well. Cool!
> 
> Question: how to break out of a paralled loop in a clean way?
> 
> The problem is finding something from blocks of data. 
> There are more blocks than there are threads. It would be enough to prevent 
> new threads starting. The currently running threads can run to the end.
> 
> Should I throw an exeption and then catch it outside the 
> ProcThreadPool.DoParallel(...) call?

Yes, that works.

 
> The best solution could be added to the wiki page, too.

I doubt there is one best solution for all problems.

You could use a boolean flag Abort somewhere. It does not even need a
critical section.


Mattias

--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to