30
30
31
31
static inline void zend_max_execution_timer_handler (void * arg )
32
32
{
33
+ #ifdef ZTS
33
34
pthread_t * tid = (pthread_t * ) arg ;
34
35
pthread_kill (* tid , ZEND_MAX_EXECUTION_TIMERS_SIGNAL );
36
+ #else
37
+ pid_t * pid = (pid_t * ) arg ;
38
+ kill (* pid , ZEND_MAX_EXECUTION_TIMERS_SIGNAL );
39
+ #endif
35
40
}
36
41
37
42
static inline void zend_max_execution_timer_cancel (void * arg )
38
43
{
39
- pthread_t * tid = (pthread_t * ) arg ;
40
- free (tid );
44
+ free (arg );
41
45
}
42
46
43
47
ZEND_API void zend_max_execution_timer_init (void ) /* {{{ */
@@ -58,10 +62,14 @@ ZEND_API void zend_max_execution_timer_init(void) /* {{{ */
58
62
EG (max_execution_timer_suspended ) = 1 ;
59
63
60
64
# ifdef ZTS
61
- pthread_t lpid = pthread_self ();
62
- pthread_t * tid = malloc (sizeof (pthread_t ));
63
- memcpy (tid , & lpid , sizeof (pthread_t ));
64
- dispatch_set_context (EG (max_execution_timer_timer ), tid );
65
+ pthread_t tid = pthread_self ();
66
+ pthread_t * ptid = malloc (sizeof (pthread_t ));
67
+ memcpy (ptid , & tid , sizeof (pthread_t ));
68
+ dispatch_set_context (EG (max_execution_timer_timer ), ptid );
69
+ #else
70
+ pid_t * ppid = malloc (sizeof (pid_t ));
71
+ * ppid = pid ;
72
+ dispatch_set_context (EG (max_execution_timer_timer ), ppid )
65
73
# endif
66
74
67
75
dispatch_source_set_event_handler_f (EG (max_execution_timer_timer ), zend_max_execution_timer_handler );
0 commit comments