[fpc-pascal] SIGTERM and thread

Mark Morgan Lloyd markMLl.fpc-pascal at telemetry.co.uk
Wed Jul 11 21:28:28 CEST 2012


jmbottu wrote:
> Hello,
> I wrote a handler to intercept the SIGTERM signal and execute some
> processing before terminating the program.
> It works fine.
> 
> But when i add the cthreads unit in the uses clause, the application seems
> to do a shutdown after the end of the handler function, and the processing
> before terminating the program can no longer run.

What's in the handler? I usually just use it to set a variable, since 
the CPU context at the time of the signal is unclear (i.e. might not be 
safe to perform a GUI op, don't know which thread was running at the 
time, might already be inside a non-reentrant function, and so on).

-- 
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]



More information about the fpc-pascal mailing list