From 320d753232e3e0faa81addd004218984ffe2aa43 Mon Sep 17 00:00:00 2001
From: Mark Grondona <mgrondona@llnl.gov>
Date: Mon, 6 Oct 2003 23:44:10 +0000
Subject: [PATCH]  o fwd_signal() was calling in interrupt handler before
 force_termination    check was made, this could result in fwd_signal() calls
 piling up on    eachother and not allowing multiple ^C's to terminate job.
 (gnats:299)

---
 src/srun/signals.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/src/srun/signals.c b/src/srun/signals.c
index 0475dbe3c77..44f37be357a 100644
--- a/src/srun/signals.c
+++ b/src/srun/signals.c
@@ -200,14 +200,15 @@ _handle_intr(job_t *job, time_t *last_intr, time_t *last_intr_sent)
 		/* terminate job */
 		if (job->state < SRUN_JOB_FORCETERM) {
 
+			if ((time(NULL) - *last_intr_sent) < 1) {
+				job_force_termination(job);
+				pthread_exit(0);
+			}
+
 			info("sending Ctrl-C to job");
-			*last_intr = time(NULL);
+			*last_intr_sent = time(NULL);
 			fwd_signal(job, SIGINT);
 
-			if ((time(NULL) - *last_intr_sent) < 1)
-				job_force_termination(job);
-			else
-				*last_intr_sent = time(NULL);
 		} else {
 			job_force_termination(job);
 		}
-- 
GitLab