1 #include <signal.h> 2 #include "alarmsleep.h" 3 4 static const char rcsid[]="$Id: alarmsleep.C,v 1.1 1998/04/16 23:53:22 mrsam Exp $"; 5 AlarmSleep(unsigned nseconds)6AlarmSleep::AlarmSleep(unsigned nseconds) : flag(0) 7 { 8 Set(nseconds); 9 do 10 { 11 sigpause(0); 12 } while (!flag); 13 Cancel(); 14 } 15 ~AlarmSleep()16AlarmSleep::~AlarmSleep() 17 { 18 } 19 handler()20void AlarmSleep::handler() 21 { 22 flag=1; 23 Set(5); // A possibility of a race condition - try again. 24 } 25