Re: Catching a signal

From: Philippe Canal <pcanal_at_fnal.gov>
Date: Wed, 26 Jan 2011 08:30:00 -0600


Hi,

See TInterruptHandler in core/rint/src/TRint.cxx and core/rint/src/TRint.h and use gSystem->SetSignalHandler.

Cheers,
Philippe

On 1/26/11 8:15 AM, Filimon Roukoutakis wrote:
> Hi, I would like to catch ctrl-C while my long loop is running under a ROOT session and then terminate gracefully back to the ROOT
> prompt (at the moment, depending on the stage within the loop (deep calls in other third-party libraries) I get the prompt,
> unhandled exceptions or crash). Schematically what we want to achieve is
> shell prompt> root
> [0] gSystem->Load("mylib.so")
> [1] myProcess->Run(<100000 times for ~3 hours>)
> .....
> <at some point pressing ctrl-C and returning gracefully to>
> [2]
> Is there any tutorial on this? I see the classes TSignalHandler but a piece of working code would help. Quickly greping in
> $ROOTSYS/tutorials did not return something. I would like if possible to avoid using signal/slots ie the signal handler should
> preferably call directly a function and not raise a ROOT/Qt type signal (but this scenario is acceptable too).
> Thanks,
> filimon
Received on Wed Jan 26 2011 - 15:30:09 CET

This archive was generated by hypermail 2.2.0 : Wed Jan 26 2011 - 17:50:01 CET