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 3c9eb67629..1ee8ba799f 100644
--- a/ext/pcntl/pcntl.c
+++ b/ext/pcntl/pcntl.c
@@ -1225,6 +1225,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()
@@ -1234,6 +1235,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);
@@ -1273,6 +1278,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 caafc10d19..44e91166ae 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