Skip to content

Commit 17ad507

Browse files
committed
Arnaud's review
1 parent ce0a8d7 commit 17ad507

File tree

4 files changed

+19
-19
lines changed

4 files changed

+19
-19
lines changed

Zend/zend_execute_API.c

+6-6
Original file line numberDiff line numberDiff line change
@@ -1403,19 +1403,19 @@ ZEND_API ZEND_NORETURN void ZEND_FASTCALL zend_timeout(void) /* {{{ */
14031403
# ifdef ZEND_MAX_EXECUTION_TIMERS
14041404
static void zend_timeout_handler(int dummy, siginfo_t *si, void *uc) /* {{{ */
14051405
{
1406-
#ifdef ZTS
1406+
# ifdef ZTS
14071407
if (!tsrm_is_managed_thread()) {
14081408
fprintf(stderr, "zend_timeout_handler() called in a thread not managed by PHP. The expected signal handler will not be called. This is probably a bug.\n");
14091409

14101410
return;
14111411
}
1412-
#endif
1412+
# endif
14131413

1414-
#ifndef __APPLE__
1414+
# ifndef __APPLE__
14151415
if (si->si_value.sival_ptr != &EG(max_execution_timer_timer)) {
1416-
#ifdef MAX_EXECUTION_TIMERS_DEBUG
1416+
# ifdef MAX_EXECUTION_TIMERS_DEBUG
14171417
fprintf(stderr, "Executing previous handler (if set) for unexpected signal SIGRTMIN received on thread %d\n", (pid_t) syscall(SYS_gettid));
1418-
#endif
1418+
# endif
14191419

14201420
if (EG(oldact).sa_sigaction) {
14211421
EG(oldact).sa_sigaction(dummy, si, uc);
@@ -1426,7 +1426,7 @@ static void zend_timeout_handler(int dummy, siginfo_t *si, void *uc) /* {{{ */
14261426

14271427
return;
14281428
}
1429-
#endif
1429+
# endif /* ifndef __APPLE__ */
14301430
# else
14311431
static void zend_timeout_handler(int dummy) /* {{{ */
14321432
{

Zend/zend_globals.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ struct _zend_executor_globals {
303303

304304
#ifdef ZEND_MAX_EXECUTION_TIMERS
305305
# ifdef __APPLE__
306-
dispatch_source_t max_execution_timer_timer;
306+
dispatch_source_t max_execution_timer_source;
307307
bool max_execution_timer_suspended;
308308
# else
309309
timer_t max_execution_timer_timer;

Zend/zend_max_execution_timer.c

+11-11
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ ZEND_API void zend_max_execution_timer_init(void) /* {{{ */
5555
}
5656

5757
dispatch_queue_global_t queue = dispatch_get_global_queue(QOS_CLASS_UTILITY, 0);
58-
EG(max_execution_timer_timer) = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, queue);
59-
if (EG(max_execution_timer_timer) == NULL) {
58+
EG(max_execution_timer_source) = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, queue);
59+
if (EG(max_execution_timer_source) == NULL) {
6060
zend_strerror_noreturn(E_ERROR, errno, "Could not create dispatch source");
6161
}
6262

@@ -67,36 +67,36 @@ ZEND_API void zend_max_execution_timer_init(void) /* {{{ */
6767
pthread_t tid = pthread_self();
6868
pthread_t *ptid = malloc(sizeof(pthread_t));
6969
memcpy(ptid, &tid, sizeof(pthread_t));
70-
dispatch_set_context(EG(max_execution_timer_timer), ptid);
70+
dispatch_set_context(EG(max_execution_timer_source), ptid);
7171
#else
7272
pid_t *ppid = malloc(sizeof(pid_t));
7373
*ppid = pid;
74-
dispatch_set_context(EG(max_execution_timer_timer), ppid);
74+
dispatch_set_context(EG(max_execution_timer_source), ppid);
7575
# endif
7676

77-
dispatch_source_set_event_handler_f(EG(max_execution_timer_timer), zend_max_execution_timer_handler);
78-
dispatch_source_set_cancel_handler_f(EG(max_execution_timer_timer), zend_max_execution_timer_cancel);
77+
dispatch_source_set_event_handler_f(EG(max_execution_timer_source), zend_max_execution_timer_handler);
78+
dispatch_source_set_cancel_handler_f(EG(max_execution_timer_source), zend_max_execution_timer_cancel);
7979
} /* }}} */
8080

8181
void zend_max_execution_timer_settime(zend_long seconds) /* {{{ */
8282
{
8383
if (seconds == 0) {
8484
if (!EG(max_execution_timer_suspended)) {
85-
dispatch_suspend(EG(max_execution_timer_timer));
85+
dispatch_suspend(EG(max_execution_timer_source));
8686
EG(max_execution_timer_suspended) = 1;
8787
}
8888

8989
return;
9090
}
9191

9292
dispatch_source_set_timer(
93-
EG(max_execution_timer_timer),
93+
EG(max_execution_timer_source),
9494
dispatch_time(DISPATCH_TIME_NOW, seconds * NSEC_PER_SEC),
9595
seconds * NSEC_PER_SEC,
9696
0
9797
);
9898
if (EG(max_execution_timer_suspended)) {
99-
dispatch_resume(EG(max_execution_timer_timer));
99+
dispatch_resume(EG(max_execution_timer_source));
100100
EG(max_execution_timer_suspended) = 0;
101101
}
102102
} /* }}} */
@@ -110,8 +110,8 @@ void zend_max_execution_timer_shutdown(void) /* {{{ */
110110

111111
EG(pid) = 0;
112112

113-
dispatch_source_cancel(EG(max_execution_timer_timer));
114-
//dispatch_release(EG(max_execution_timer_timer));
113+
dispatch_source_cancel(EG(max_execution_timer_source));
114+
//dispatch_release(EG(max_execution_timer_source));
115115
} /* }}} */
116116

117117
# else

Zend/zend_max_execution_timer.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
#include "zend_long.h"
2323

2424
# ifdef __APPLE__
25-
#define ZEND_MAX_EXECUTION_TIMERS_SIGNAL SIGALRM
25+
#define ZEND_MAX_EXECUTION_TIMERS_SIGNAL SIGIO
2626
# else
2727
#define ZEND_MAX_EXECUTION_TIMERS_SIGNAL SIGRTMIN
2828
# endif

0 commit comments

Comments
 (0)