[fpc-devel] Exceptions in threads

Luca Olivetti luca at ventoso.org
Wed Dec 10 22:12:49 CET 2008


En/na Mattias Gärtner ha escrit:
> I'm writing a unit to simplify parallel methods/procedures.
> 
> For example:
>   DoParallel(@AMethod,StartIndex,EndIndex,Data);
> 
> The AMethod is executed with several threads in parallel.
> 
> What should happen when an exception occurs?

AFAIK any unhandled exception in a thread will cause it to silently die

> It would be nice if the exception can be transfered to the main thread.
> Is this possible? How?

I don't know, set a flag in the thread and check it periodically from 
the main thread?
(Florian's suggestion does the reverse: raise in a thread an exception 
occurred while executing in the context of the main thread)

Bye
-- 
Luca



More information about the fpc-devel mailing list