DataMuseum.dk

Presents historical artifacts from the history of:

DKUUG/EUUG Conference tapes

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about DKUUG/EUUG Conference tapes

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - metrics - download
Index: T t

⟦833303e53⟧ TextFile

    Length: 1006 (0x3ee)
    Types: TextFile
    Names: »timeout.c«

Derivation

└─⟦2d1937cfd⟧ Bits:30007241 EUUGD22: P.P 5.0
    └─⟦dc59850a2⟧ »EurOpenD22/pp5.0/pp-5.tar.Z« 
        └─⟦e5a54fb17⟧ 
            └─⟦this⟧ »pp-5.0/Lib/util/timeout.c« 

TextFile

/* timeout.c: provide a timeout function */

# ifndef lint
static char Rcsid[] = "@(#)$Header: /cs/research/pp/hubris/pp-beta/Lib/util/RCS/timeout.c,v 5.0 90/09/20 16:18:05 pp Exp Locker: pp $";
# endif

/*
 * $Header: /cs/research/pp/hubris/pp-beta/Lib/util/RCS/timeout.c,v 5.0 90/09/20 16:18:05 pp Exp Locker: pp $
 *
 * $Log:	timeout.c,v $
 * Revision 5.0  90/09/20  16:18:05  pp
 * rcsforce : 5.0 public release
 * 
 */



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



/* __________________________________________________________________________


provide a timeout function for jobs that could potentially hang
Only one entry is given - timeout(value)
timeout(value) will be longjumped back to

____________________________________________________________________________*/




jmp_buf _timeobuf;
static SFP      oldalrm;


SFD _tcatch()
{
	longjmp(_timeobuf,1);
}


void _timeout(val)
unsigned val;
{
	if(val)
		oldalrm = signal (SIGALRM, _tcatch);
	alarm(val);
	if (!val)
		signal (SIGALRM, oldalrm);
}