1
0
mirror of https://github.com/Interlisp/maiko.git synced 2026-01-15 15:57:13 +00:00
Interlisp.maiko/inc/timeout.h
Nick Briggs 3d9f090e70
Cleanup of includes and related changes based on include-what-you-use diagnostics (#436)
Remove unused #define PERCENT_OF_SCREEN in MyWindow.h
Move structures for dir.c to dirdefs.h where they are used
Resolve S_CHAR vs S_CHARACTER in favor of S_CHARACTER and cleanup #defines
Fix  = vs == bug in FSDEBUG code in dir.c
Eliminate duplicate/unused constant definitions in gcr.c
Declare static internal function bytecmp in mkatom.c
Update many source and include files to include headers for what they use
2022-08-10 11:07:57 -07:00

70 lines
1.7 KiB
C

#ifndef TIMEOUT_H
#define TIMEOUT_H 1
/* $Id: timeout.h,v 1.2 1999/01/03 02:06:27 sybalsky Exp $ (C) Copyright Venue, All Rights Reserved */
/************************************************************************/
/* */
/* (C) Copyright 1989-98 Venue. All Rights Reserved. */
/* Manufactured in the United States of America. */
/* */
/************************************************************************/
#include <setjmp.h> /* for jmp_buf */
#include <unistd.h> /* for alarm */
extern jmp_buf jmpbuf;
/*** TIMEOUT_TIME is changeable by UNIX env var LDEFILETIMEOUT.
#define TIMEOUT_TIME 10 **/
extern int TIMEOUT_TIME;
#define SETJMP(x) \
{ \
if(setjmp(jmpbuf) != 0) return(x); \
}
#define TIMEOUT(exp) \
{ \
alarm(TIMEOUT_TIME); \
INTRSAFE(exp); \
alarm(0); \
}
#define TIMEOUT0(exp) \
{ \
alarm(TIMEOUT_TIME); \
INTRSAFE0(exp); \
alarm(0); \
}
#define S_TOUT(exp) \
alarm(TIMEOUT_TIME),\
(exp), \
alarm(0)
#define ERRSETJMP(rval) \
{ \
if(setjmp(jmpbuf) != 0) \
{ \
*Lisp_errno = 100; \
return(rval); \
} \
}
/************************************************************************/
/* */
/* INTRSAFE */
/* */
/* Put a check for EINTR around a system call, and keep executing */
/* the call until we don't get that error any more. */
/* */
/************************************************************************/
#define INTRSAFE(exp) \
do {errno = 0; } while ((exp) == -1 && errno == EINTR)
#define INTRSAFE0(exp) \
do {errno = 0; } while ((exp) == NULL && errno == EINTR)
#endif /* TIMEOUT_H */