[fpc-pascal] Threads and runtime errors
Vinzent Hoefler
JeLlyFish.software at gmx.net
Mon Jun 25 09:50:48 CEST 2007
On Friday 22 June 2007 06:27, Carsten Bager wrote:
> In the small threads program below I force a runtime error in a
> thread. How do I get access to the output from the thread when it
> stops? This program does not write anything to the terminal when the
> thread stops.
In case a runtime error occurs, the thread object stores the exception
which occured, so before destroying the threads try something like:
|if Assigned (t1.FatalException) do
| WriteLn (StdErr, t1.FatalException.ClassName,
| t1.FatalException.Message);
Alternatively you can embrace the Execute method with a try-except
statement.
Regards,
Vinzent.
More information about the fpc-pascal
mailing list