summaryrefslogtreecommitdiff
path: root/ext/pcntl/php_signal.c
diff options
context:
space:
mode:
authorArnaud Le Blanc <lbarnaud@php.net>2010-11-01 22:29:25 +0000
committerArnaud Le Blanc <lbarnaud@php.net>2010-11-01 22:29:25 +0000
commit61e7730ee89ad86e8b56f262f9d5ae698b445a8a (patch)
treeceea8bd07392267dea218db0a5689f3a7cad6abd /ext/pcntl/php_signal.c
parenta9507474e3ec43dbffc83875229ee155a425f94d (diff)
downloadphp-git-61e7730ee89ad86e8b56f262f9d5ae698b445a8a.tar.gz
fixed bug #52784 (Race condition when handling many
concurrent signals)
Diffstat (limited to 'ext/pcntl/php_signal.c')
-rw-r--r--ext/pcntl/php_signal.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/ext/pcntl/php_signal.c b/ext/pcntl/php_signal.c
index 6963e6ff37..d3f86d0f12 100644
--- a/ext/pcntl/php_signal.c
+++ b/ext/pcntl/php_signal.c
@@ -22,11 +22,15 @@
/* php_signal using sigaction is derrived from Advanced Programing
* in the Unix Environment by W. Richard Stevens p 298. */
-Sigfunc *php_signal(int signo, Sigfunc *func, int restart)
+Sigfunc *php_signal4(int signo, Sigfunc *func, int restart, int mask_all)
{
struct sigaction act,oact;
act.sa_handler = func;
- sigemptyset(&act.sa_mask);
+ if (mask_all) {
+ sigfillset(&act.sa_mask);
+ } else {
+ sigemptyset(&act.sa_mask);
+ }
act.sa_flags = 0;
if (signo == SIGALRM || (! restart)) {
#ifdef SA_INTERRUPT
@@ -43,6 +47,11 @@ Sigfunc *php_signal(int signo, Sigfunc *func, int restart)
return oact.sa_handler;
}
+Sigfunc *php_signal(int signo, Sigfunc *func, int restart)
+{
+ return php_signal4(signo, func, restart, 0);
+}
+
/*
* Local variables:
* tab-width: 4