alarm.c

gurba-0.40/src/host/unix/alarm.c · 549 B

From the archive gurba.tgz

Download the archive   « Back to the archive contents

# include "dgd.h"
# include <signal.h>

static bool timeout;		/* alarm timed out */

/*
 * NAME:	intr
 * DESCRIPTION:	catch an alarm interrupt
 */
static void intr(arg)
int arg;
{
    timeout = TRUE;
}

/*
 * NAME:	P->alarm()
 * DESCRIPTION:	cause an alarm signal to occur after the given number of
 *		seconds
 */
void P_alarm(delay)
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;
}

Site Stats

Snippets: 1791
Codebases: 571