BLAlarm Class Reference

#include <BLAlarm.hh>

List of all members.


Detailed Description

class BLAlarm implements an alarm clock.

used to prevent an infinite tracking loop from hanging an entire job.

If BLSignal is also used, BLSignal::init() must be called first.

Static Public Member Functions

static void clear ()
 clear will clear any alarm.
static void set (int seconds)
 set() sets an alarm in the future. Implicitly clears any previous alarm. seconds <= 0 does a clear().
static void init ()
 init() will setup the signal handler Must be called before set().

Static Private Member Functions

static void sighandler (int sig)
 sighandler() handles the alarm signal


Member Function Documentation

void BLAlarm::clear (  )  [static]

clear will clear any alarm.

Linux and Mac OS X handle alarm signals natively.

Referenced by BLManager::EndOfEventAction(), and BLManager::Notify().

00100 {
00101         alarm(0);
00102 }

void BLAlarm::set ( int  seconds  )  [static]

set() sets an alarm in the future. Implicitly clears any previous alarm. seconds <= 0 does a clear().

Referenced by BLManager::BeginOfEventAction().

00105 {
00106         alarm(seconds);
00107 }

void BLAlarm::init (  )  [static]

init() will setup the signal handler Must be called before set().

References sighandler().

Referenced by BLManager::BLManager().

00110 {
00111         signal(SIGALRM,sighandler); 
00112 }

void BLAlarm::sighandler ( int  sig  )  [static, private]

sighandler() handles the alarm signal

References BLRunManager::abandonCurrentEvent(), and BLRunManager::getObject().

Referenced by init().

00115 { 
00116         signal(sig,sighandler); 
00117         BLRunManager::getObject()->abandonCurrentEvent();
00118         G4Exception("BLAlarm","Alarm Signal",FatalException,
00119                         "SIGALRM fired, cannot be recovered");
00120 }


The documentation for this class was generated from the following files:
g4beamline