alarm.c
gurba-0.40/src/host/beos/alarm.c · 537 B
From the archive gurba.tgz
Download the archive « Back to the archive contents
# include <signal.h>
# include "dgd.h"
static bool timeout; /* alarm timed out */
/*
* NAME: intr
* DESCRIPTION: catch an alarm interrupt
*/
static void intr(int arg)
{
timeout = TRUE;
}
/*
* NAME: P->alarm()
* DESCRIPTION: cause an alarm signal to occur after the given number of
* seconds
*/
void P_alarm(unsigned int delay)
{
timeout = FALSE;
signal(SIGALRM, intr);
alarm(delay);
}
/*
* NAME: P->timeout()
* DESCRIPTION: return the value of the timeout flag
*/
bool P_timeout()
{
return timeout;
}