Catching a signal

From: Filimon Roukoutakis <Filimon.Roukoutakis_at_cern.ch>
Date: Wed, 26 Jan 2011 15:15:06 +0100


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:15:21 CET

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