00001 00006 #include "usr_signals.H" 00007 00008 // this is tiny and somewhat "dirty" 00009 // the stuff presented here is not interrupt-safe! 00010 // so it could be that a signal just gets lost! 00011 // (but in the moment we just don't care about...) 00012 00013 00014 bool Cusr_signal_proxy::SIGUSR1_received = false; 00015 bool Cusr_signal_proxy::SIGUSR2_received = false; 00016 00017 void Cusr_signal_proxy::signalhandler(int intr_signal) 00018 { 00019 if (intr_signal==SIGUSR1) 00020 { 00021 SIGUSR1_received=true; 00022 signal(SIGUSR1,signalhandler); 00023 } 00024 00025 if (intr_signal==SIGUSR2) 00026 { 00027 SIGUSR2_received=true; 00028 signal(SIGUSR2,signalhandler); 00029 } 00030 } 00031 00032 00033 #if 0 00034 // just a small test 00035 int main() 00036 { 00037 Cusr_signal_proxy U; 00038 00039 for (int i=0; i<100000; ++i) 00040 for (int j=0; j<1000000; ++j) 00041 { 00042 if (U.got_SIGUSR1()) return i/100; 00043 } 00044 return 0; 00045 } 00046 #endif