From 3aaeae0ee6fa13209fff93fd5d9dfe709804cee5 Mon Sep 17 00:00:00 2001 From: Derrick Brashear Date: Thu, 10 Feb 2005 03:02:46 +0000 Subject: [PATCH] linux-lwp-work-around-signal-lossage-20050209 some versions of linux seem to lose signals sometimes. very annoying. --- src/lwp/iomgr.c | 6 ++++-- src/lwp/lwp.h | 6 ++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/lwp/iomgr.c b/src/lwp/iomgr.c index 9c26b84..04372c0 100644 --- a/src/lwp/iomgr.c +++ b/src/lwp/iomgr.c @@ -536,10 +536,11 @@ static int IOMGR(void *dummy) iomgr_timeout.tv_sec = 100000000; iomgr_timeout.tv_usec = 0; } -#ifdef AFS_NT40_ENV +#if defined(AFS_NT40_ENV) || defined(AFS_LINUX24_ENV) /* On NT, signals don't interrupt a select call. So this can potentially * lead to long wait times before a signal is honored. To avoid this we * dont do select() for longer than IOMGR_MAXWAITTIME (5 secs) */ + /* Whereas Linux seems to sometimes "lose" signals */ if (iomgr_timeout.tv_sec > (IOMGR_MAXWAITTIME - 1)) { iomgr_timeout.tv_sec = IOMGR_MAXWAITTIME; iomgr_timeout.tv_usec = 0; @@ -640,11 +641,12 @@ static int IOMGR(void *dummy) /* Real timeout only if signal handler hasn't set iomgr_timeout to zero. */ -#ifdef AFS_NT40_ENV +#if defined(AFS_NT40_ENV) || defined(AFS_LINUX24_ENV) /* On NT, real timeout only if above and if iomgr_timeout * interval is equal to timeout interval (i.e., not adjusted * to check for pseudo-signals). */ + /* And also for Linux as above */ if (iomgr_timeout.tv_sec != timeout.tv_sec || iomgr_timeout.tv_usec != timeout.tv_usec) { /* signal check interval timed out; not real timeout */ diff --git a/src/lwp/lwp.h b/src/lwp/lwp.h index 1e62cae..f9139e4 100644 --- a/src/lwp/lwp.h +++ b/src/lwp/lwp.h @@ -389,8 +389,14 @@ extern int LWP_WaitProcess(char *event); extern PROCESS LWP_ThreadId(void); #endif +#ifdef AFS_LINUX24_ENV +/* max time we are allowed to spend in a select call on Linux to avoid + lost signal issues */ +#define IOMGR_MAXWAITTIME 60 /* seconds */ +#else /* max time we are allowed to spend in a select call on NT */ #define IOMGR_MAXWAITTIME 5 /* seconds */ +#endif /* max time we spend on a select in a Win95 DOS box */ #define IOMGR_WIN95WAITTIME 5000 /* microseconds */ -- 1.9.4