00001 /* alarm.h 00002 */ 00003 #ifndef MISC_ALARM_H 00004 #define MISC_ALARM_H 00005 00006 namespace osl 00007 { 00008 namespace misc 00009 { 00010 struct AlarmSwitch 00011 { 00012 volatile int *notify; 00013 explicit AlarmSwitch(volatile int *notify) : notify(notify) 00014 { 00015 } 00016 }; 00017 00021 class Alarm 00022 { 00023 static void catchSignal(int signum); 00024 // ͤϽ, ݥꤦ 00025 static volatile int * volatile notify; 00026 public: 00027 enum { 00029 WATCHING, 00031 TIMEOUT, 00033 UNAVAILABLE 00034 }; 00040 static bool set(int timeout, AlarmSwitch alarm); 00041 static void reset(AlarmSwitch alarm); 00042 }; 00043 } // namespace misc 00044 using misc::Alarm; 00045 using misc::AlarmSwitch; 00046 } // namespace osl 00047 00048 #endif /* MISC_ALARM_H */ 00049 // ;;; Local Variables: 00050 // ;;; mode:c++ 00051 // ;;; c-basic-offset:2 00052 // ;;; End: