summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ext/pcntl/pcntl.c7
-rw-r--r--ext/pcntl/php_pcntl.h1
2 files changed, 8 insertions, 0 deletions
diff --git a/ext/pcntl/pcntl.c b/ext/pcntl/pcntl.c
index 301002132c..1b5efed1c1 100644
--- a/ext/pcntl/pcntl.c
+++ b/ext/pcntl/pcntl.c
@@ -1212,6 +1212,7 @@ static void pcntl_signal_handler(int signo)
PCNTL_G(head) = psig;
}
PCNTL_G(tail) = psig;
+ PCNTL_G(pending_signals) = 1;
}
void pcntl_signal_dispatch()
@@ -1221,6 +1222,10 @@ void pcntl_signal_dispatch()
sigset_t mask;
sigset_t old_mask;
TSRMLS_FETCH();
+
+ if(!PCNTL_G(pending_signals)) {
+ return;
+ }
/* Mask all signals */
sigfillset(&mask);
@@ -1258,6 +1263,8 @@ void pcntl_signal_dispatch()
queue = next;
}
+ PCNTL_G(pending_signals) = 0;
+
/* Re-enable queue */
PCNTL_G(processing_signal_queue) = 0;
diff --git a/ext/pcntl/php_pcntl.h b/ext/pcntl/php_pcntl.h
index d02d6867f4..fcae3e0466 100644
--- a/ext/pcntl/php_pcntl.h
+++ b/ext/pcntl/php_pcntl.h
@@ -69,6 +69,7 @@ ZEND_BEGIN_MODULE_GLOBALS(pcntl)
int processing_signal_queue;
struct php_pcntl_pending_signal *head, *tail, *spares;
int last_error;
+ volatile char pending_signals;
ZEND_END_MODULE_GLOBALS(pcntl)
#ifdef ZTS