TSignalHandler and CINT

Anthony A. Faust (afaust@Phys.UAlberta.CA)
Wed, 19 Aug 1998 15:44:42 -0600 (MDT)


Hello

I would like to use signals in a root DAQ macro to allow the macro
to exit cleanly from its internal loop when a kSigInterrupt is caught.

From a previous roottalk post on this subject I constructed the
following test......

TDAQInterruptHandler.C
{

//----- Interrupt signal handler
//_____________________________________________
class TDAQInterruptHandler : public TSignalHandler {
public:
TDAQInterruptHandler() :
TSignalHandler(7, kFALSE) { fOk = kTRUE; }
// TSignalHandler((ESignals)kSigInterrupt, kFALSE) { fOk = kTRUE; }
Bool_t Notify();
Bool_t Ok() { return fOk; }
public:
Bool_t fOk = kTRUE;
};
//_____________________________________________
Bool_t TDAQInterruptHandler::Notify()
{
Printf("n *** DAQ Break *** keyboard interrupt");
fOk = kFALSE;
return kTRUE;
}

}

and a test macro loop.C

Int_t loop(void)
{
gROOT->Reset();
gROOT->LoadMacro("TDAQInterruptHandler.C");

// Install interrupt handler
TDAQInterruptHandler *ih = new TDAQInterruptHandler();
gSystem->AddSignalHandler(ih);
gROOT->GetApplication->SetSignalHandler(ih);

while(ih->Ok());

gSystem->RemoveSignalHandler(ih);

return 0;
}

suffice it to say this isn't working.

First, what is the correct way to reference enumerated variables,
such as kSigInterrupt defined in TSysEvtHandler.h, in a macro since cint
complains if they are included?

Second, I found that TApplication::SetSignalHandler is protected
implying that this may be the wrong way to go about this. Can anyone
recommend a better method?

Thanks for your help.

----------------------------------------------------------------------------
Anthony A. Faust | Mail me with "PGP" in subject for my pgp key
Centre for Subatomic Research | FAX: 403 492 3408
University of Alberta | PHONE: 403 492 5017
Edmonton, Alberta, Canada | Do not Fold, Spindle, or Mutilate.
----------------------------------------------------------------------------