about summary refs log tree commit diff
path: root/Src
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2004-04-19 16:02:17 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2004-04-19 16:02:17 +0000
commitb5ceb73026791281532ea9638cadac491b27959b (patch)
treecf3a758d87070a5a6b7d8e003e1f015c41b7a9d9 /Src
parent55940daefb5b75bb929bda03612fafab6beedaff (diff)
downloadzsh-b5ceb73026791281532ea9638cadac491b27959b.tar.gz
zsh-b5ceb73026791281532ea9638cadac491b27959b.tar.xz
zsh-b5ceb73026791281532ea9638cadac491b27959b.zip
zsh-users/7365: new TRAPS_ASYNC option
Diffstat (limited to 'Src')
-rw-r--r--Src/jobs.c9
-rw-r--r--Src/options.c3
-rw-r--r--Src/signals.c5
-rw-r--r--Src/zsh.h1
4 files changed, 14 insertions, 4 deletions
diff --git a/Src/jobs.c b/Src/jobs.c
index 0188989df..072a91744 100644
--- a/Src/jobs.c
+++ b/Src/jobs.c
@@ -994,7 +994,11 @@ zwaitjob(int job, int sig)
     int q = queue_signal_level();
     Job jn = jobtab + job;
 
-    dont_queue_signals();
+    queue_not_sigchld++;
+    if (isset(TRAPSASYNC))
+	dont_queue_signals();
+    else
+	queue_signals();
     child_block();		 /* unblocked during child_suspend() */
     if (jn->procs || jn->auxprocs) { /* if any forks were done         */
 	jn->stat |= STAT_LOCKED;
@@ -1026,6 +1030,9 @@ zwaitjob(int job, int sig)
     }
     child_unblock();
     restore_queue_signals(q);
+    if (!queueing_enabled)
+	run_queued_signals();
+    queue_not_sigchld--;
 }
 
 /* wait for running job to finish */
diff --git a/Src/options.c b/Src/options.c
index 359229a57..7fd9906ee 100644
--- a/Src/options.c
+++ b/Src/options.c
@@ -203,6 +203,7 @@ static struct optname optns[] = {
 {NULL, "singlelinezle",	      OPT_KSH,			 SINGLELINEZLE},
 {NULL, "sunkeyboardhack",     0,			 SUNKEYBOARDHACK},
 {NULL, "transientrprompt",    0,			 TRANSIENTRPROMPT},
+{NULL, "trapsasync",	      OPT_EMULATE|OPT_NONBOURNE, TRAPSASYNC},
 {NULL, "typesetsilent",	      OPT_EMULATE|OPT_BOURNE,	 TYPESETSILENT},
 {NULL, "unset",		      OPT_EMULATE|OPT_BSHELL,	 UNSET},
 {NULL, "verbose",	      0,			 VERBOSE},
@@ -346,7 +347,7 @@ static short kshletters[LAST_OPT - FIRST_OPT + 1] = {
     /* Q */  0,
     /* R */  0,
     /* S */  0,
-    /* T */  0,
+    /* T */  TRAPSASYNC,
     /* U */  0,
     /* V */  0,
     /* W */  0,
diff --git a/Src/signals.c b/Src/signals.c
index dbecdf20c..8939d1ba1 100644
--- a/Src/signals.c
+++ b/Src/signals.c
@@ -49,7 +49,7 @@ mod_export int nsigtrapped;
 /* Variables used by signal queueing */
 
 /**/
-mod_export int queueing_enabled, queue_front, queue_rear;
+mod_export int queueing_enabled, queue_front, queue_rear, queue_not_sigchld;
 /**/
 mod_export int signal_queue[MAX_QUEUE_SIZE];
 /**/
@@ -425,7 +425,8 @@ zhandler(int sig)
     }
 #endif
 
-    if (queueing_enabled) {           /* Are we queueing signals now?      */
+    /* Are we queueing signals now?      */
+    if (queueing_enabled && (sig != SIGCHLD || !queue_not_sigchld)) {
         int temp_rear = ++queue_rear % MAX_QUEUE_SIZE;
 
 	DPUTS(temp_rear == queue_front, "BUG: signal queue full");
diff --git a/Src/zsh.h b/Src/zsh.h
index a0b95bf42..523e8b2c3 100644
--- a/Src/zsh.h
+++ b/Src/zsh.h
@@ -1523,6 +1523,7 @@ enum {
     SINGLELINEZLE,
     SUNKEYBOARDHACK,
     TRANSIENTRPROMPT,
+    TRAPSASYNC,
     TYPESETSILENT,
     UNSET,
     VERBOSE,