TSignalHandler and CINT

From: Anthony A. Faust (afaust@Phys.UAlberta.CA)
Date: Wed Aug 19 1998 - 23:44:42 MEST


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. 
----------------------------------------------------------------------------



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:34:36 MET