linux-lwp-work-around-signal-lossage-20050209
authorDerrick Brashear <shadow@dementia.org>
Thu, 10 Feb 2005 03:02:46 +0000 (03:02 +0000)
committerDerrick Brashear <shadow@dementia.org>
Thu, 10 Feb 2005 03:02:46 +0000 (03:02 +0000)
some versions of linux seem to lose signals sometimes. very annoying.

src/lwp/iomgr.c
src/lwp/lwp.h

index 9c26b84..04372c0 100644 (file)
@@ -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 */
index 1e62cae..f9139e4 100644 (file)
@@ -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 */