Skip to content

Commit 9233f26

Browse files
committed
call zend_timeout_handler directly
1 parent 17ad507 commit 9233f26

File tree

3 files changed

+11
-6
lines changed

3 files changed

+11
-6
lines changed

Zend/zend_execute.h

+4
Original file line numberDiff line numberDiff line change
@@ -400,6 +400,10 @@ ZEND_API zend_class_entry *zend_fetch_class(zend_string *class_name, uint32_t fe
400400
ZEND_API zend_class_entry *zend_fetch_class_with_scope(zend_string *class_name, uint32_t fetch_type, zend_class_entry *scope);
401401
ZEND_API zend_class_entry *zend_fetch_class_by_name(zend_string *class_name, zend_string *lcname, uint32_t fetch_type);
402402

403+
#if defined(__APPLE__) && !defined(ZTS)
404+
void zend_timeout_handler(void);
405+
#endif
406+
403407
ZEND_API zend_function * ZEND_FASTCALL zend_fetch_function(zend_string *name);
404408
ZEND_API zend_function * ZEND_FASTCALL zend_fetch_function_str(const char *name, size_t len);
405409
ZEND_API void ZEND_FASTCALL zend_init_func_run_time_cache(zend_op_array *op_array);

Zend/zend_execute_API.c

+4
Original file line numberDiff line numberDiff line change
@@ -1401,7 +1401,11 @@ ZEND_API ZEND_NORETURN void ZEND_FASTCALL zend_timeout(void) /* {{{ */
14011401

14021402
#ifndef ZEND_WIN32
14031403
# ifdef ZEND_MAX_EXECUTION_TIMERS
1404+
# if defined(__APPLE__) && !defined(ZTS)
1405+
void zend_timeout_handler(void) /* {{{ */
1406+
# else
14041407
static void zend_timeout_handler(int dummy, siginfo_t *si, void *uc) /* {{{ */
1408+
# endif
14051409
{
14061410
# ifdef ZTS
14071411
if (!tsrm_is_managed_thread()) {

Zend/zend_max_execution_timer.c

+3-6
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
# ifdef ZTS
2323
#include <pthread.h>
2424
# else
25-
#include <signal.h>
25+
#include "zend_execute.h"
2626
# endif
2727

2828
#include "zend.h"
@@ -36,8 +36,7 @@ static inline void zend_max_execution_timer_handler(void *arg)
3636
pthread_t *tid = (pthread_t *) arg;
3737
pthread_kill(*tid, ZEND_MAX_EXECUTION_TIMERS_SIGNAL);
3838
#else
39-
pid_t *pid = (pid_t *) arg;
40-
kill(*pid, ZEND_MAX_EXECUTION_TIMERS_SIGNAL);
39+
zend_timeout_handler();
4140
#endif
4241
}
4342

@@ -69,9 +68,7 @@ ZEND_API void zend_max_execution_timer_init(void) /* {{{ */
6968
memcpy(ptid, &tid, sizeof(pthread_t));
7069
dispatch_set_context(EG(max_execution_timer_source), ptid);
7170
#else
72-
pid_t *ppid = malloc(sizeof(pid_t));
73-
*ppid = pid;
74-
dispatch_set_context(EG(max_execution_timer_source), ppid);
71+
//dispatch_set_context(EG(max_execution_timer_source), NULL);
7572
# endif
7673

7774
dispatch_source_set_event_handler_f(EG(max_execution_timer_source), zend_max_execution_timer_handler);

0 commit comments

Comments
 (0)