From fcc00615be2cf733b91147396e017d3b96cea07b Mon Sep 17 00:00:00 2001 From: ericm Date: Thu, 28 Aug 2003 15:25:38 +0000 Subject: [PATCH] [portals]: in handler of SIGALRM, we must reenable SIGALRM before longjmp, because it's automatically disabled when entering handler. --- lnet/lnet/api-eq.c | 11 ++++++++++- lustre/portals/portals/api-eq.c | 11 ++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/lnet/lnet/api-eq.c b/lnet/lnet/api-eq.c index c8734f7..9bc9c36 100644 --- a/lnet/lnet/api-eq.c +++ b/lnet/lnet/api-eq.c @@ -123,13 +123,22 @@ static jmp_buf eq_jumpbuf; static void eq_timeout(int signal) { + sigset_t set; + + /* signal will be automatically disabled in sig handler, + * must enable it before long jump + */ + sigemptyset(&set); + sigaddset(&set, SIGALRM); + sigprocmask(SIG_UNBLOCK, &set, NULL); + longjmp(eq_jumpbuf, -1); } int PtlEQWait_timeout(ptl_handle_eq_t eventq_in, ptl_event_t * event_out, int timeout) { - static void (*prev) (int); + static void (*prev) (int) = NULL; static int left_over; time_t time_at_start; int rc; diff --git a/lustre/portals/portals/api-eq.c b/lustre/portals/portals/api-eq.c index c8734f7..9bc9c36 100644 --- a/lustre/portals/portals/api-eq.c +++ b/lustre/portals/portals/api-eq.c @@ -123,13 +123,22 @@ static jmp_buf eq_jumpbuf; static void eq_timeout(int signal) { + sigset_t set; + + /* signal will be automatically disabled in sig handler, + * must enable it before long jump + */ + sigemptyset(&set); + sigaddset(&set, SIGALRM); + sigprocmask(SIG_UNBLOCK, &set, NULL); + longjmp(eq_jumpbuf, -1); } int PtlEQWait_timeout(ptl_handle_eq_t eventq_in, ptl_event_t * event_out, int timeout) { - static void (*prev) (int); + static void (*prev) (int) = NULL; static int left_over; time_t time_at_start; int rc; -- 1.8.3.1