Skip to content

Commit c6675d8

Browse files
committed
feat: use real-time signal
1 parent 9e6b557 commit c6675d8

File tree

2 files changed

+4
-10
lines changed

2 files changed

+4
-10
lines changed

Zend/zend_execute_API.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1324,7 +1324,7 @@ static void zend_timeout_handler(int dummy, siginfo_t *si, void *uc) /* {{{ */
13241324
{
13251325
if (si->si_value.sival_ptr != &EG(timer)) {
13261326
#ifdef TIMER_DEBUG
1327-
fprintf(stderr, "Executing previous handler (if set) for unexpected signal SIGIO received on thread %d\n", (pid_t) syscall(SYS_gettid));
1327+
fprintf(stderr, "Executing previous handler (if set) for unexpected signal SIGRTMIN received on thread %d\n", (pid_t) syscall(SYS_gettid));
13281328
#endif
13291329

13301330
if (EG(oldact).sa_sigaction) {
@@ -1449,9 +1449,9 @@ static void zend_set_timeout_ex(zend_long seconds, bool reset_signals) /* {{{ */
14491449
act.sa_sigaction = zend_timeout_handler;
14501450
sigemptyset(&act.sa_mask);
14511451
act.sa_flags = SA_ONSTACK | SA_SIGINFO;
1452-
sigaction(SIGIO, &act, NULL);
1452+
sigaction(SIGRTMIN, &act, NULL);
14531453
sigemptyset(&sigset);
1454-
sigaddset(&sigset, SIGIO);
1454+
sigaddset(&sigset, SIGRTMIN);
14551455
sigprocmask(SIG_UNBLOCK, &sigset, NULL);
14561456
}
14571457
#elif defined(HAVE_SETITIMER)

Zend/zend_timer.c

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,7 @@ ZEND_API void zend_timer_init(void) /* {{{ */
3838
struct sigevent sev;
3939
sev.sigev_notify = SIGEV_THREAD_ID;
4040
sev.sigev_value.sival_ptr = &EG(timer);
41-
// The chosen signal must:
42-
// 1. not be used internally by libc
43-
// 2. be allowed to happen spuriously without consequences
44-
// 3. not be commonly used by applications, this excludes SIGALRM, SIGUSR1 and SIGUSR2
45-
// 4. not be used by profilers, this excludes SIGPROF
46-
// 5. not be used internally by runtimes of programs that can embed PHP, this excludes SIGURG, which is used by Go
47-
sev.sigev_signo = SIGIO;
41+
sev.sigev_signo = SIGRTMIN;
4842
sev.sigev_notify_thread_id = (pid_t) syscall(SYS_gettid);
4943

5044
EG(pid) = getpid();

0 commit comments

Comments
 (0)