Skip to content

Commit 1d2a3c6

Browse files
committed
more debug details
1 parent 3483de2 commit 1d2a3c6

File tree

2 files changed

+17
-12
lines changed

2 files changed

+17
-12
lines changed

Zend/zend.c

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -821,6 +821,10 @@ static void executor_globals_dtor(zend_executor_globals *executor_globals) /* {{
821821
# ifdef ZEND_TIMER
822822
static void zend_timer_create() /* {{{ */
823823
{
824+
# ifdef TIMER_DEBUG
825+
fprintf(stderr, "Trying to create timer on thread %d\n", (uintmax_t) EG(timer), sev.sigev_notify_thread_id);
826+
# endif
827+
824828
struct sigevent sev;
825829
sev.sigev_notify = SIGEV_THREAD_ID;
826830
sev.sigev_value.sival_ptr = &EG(timer);
@@ -861,17 +865,17 @@ static void zend_thread_shutdown_handler(void) { /* {{{ */
861865
zend_interned_strings_dtor();
862866

863867
# ifdef ZEND_TIMER
864-
timer_t timer = EG(timer);
868+
# ifdef TIMER_DEBUG
869+
fprintf(stderr, "Trying to delete timer %#jx thread %d\n", (uintmax_t) EG(timer), (pid_t) syscall(SYS_gettid));
870+
# endif
865871

866-
if (timer == 0)
867-
zend_error_noreturn(E_ERROR, "Could not c timer");
872+
timer_t timer = EG(timer);
873+
if (timer == 0) zend_error_noreturn(E_ERROR, "Timer not created");
868874

869-
if (timer_delete(timer) != 0)
875+
int err = timer_delete(timer);
876+
EG(timer) = 0;
877+
if (err != 0)
870878
zend_strerror_noreturn(E_ERROR, errno, "Could not delete timer");
871-
872-
# ifdef TIMER_DEBUG
873-
fprintf(stderr, "Timer %#jx deleted on thread %d\n", (uintmax_t) EG(timer), (pid_t) syscall(SYS_gettid));
874-
# endif
875879
# endif
876880
}
877881
/* }}} */

Zend/zend_execute_API.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,11 @@ ZEND_API void zend_shutdown_executor_values(bool fast_shutdown)
391391
static void zend_timer_settime(zend_long seconds) /* {{{ }*/
392392
{
393393
timer_t timer = EG(timer);
394+
395+
# ifdef TIMER_DEBUG
396+
fprintf(stderr, "Trying to set timer %#jx on thread %d (%ld seconds)\n", (uintmax_t) timer, (pid_t) syscall(SYS_gettid), seconds);
397+
# endif
398+
394399
if (timer == 0) zend_error_noreturn(E_ERROR, "Timer not created");
395400

396401
struct itimerspec its;
@@ -399,10 +404,6 @@ static void zend_timer_settime(zend_long seconds) /* {{{ }*/
399404

400405
if (timer_settime(timer, 0, &its, NULL) != 0)
401406
zend_strerror_noreturn(E_ERROR, errno, "Could not set timer");
402-
403-
# ifdef TIMER_DEBUG
404-
fprintf(stderr, "Timer %#jx set on thread %d (%ld seconds)\n", (uintmax_t) timer, (pid_t) syscall(SYS_gettid), seconds);
405-
# endif
406407
}
407408
/* }}} */
408409
#endif

0 commit comments

Comments
 (0)