Skip to content

Commit 5d93eab

Browse files
committed
Don't reset SIGG(running) when calling zend_on_timeout
This is only an internal callback nowadays and does not actually run any user code. It must be async signal safe.
1 parent 091d53c commit 5d93eab

File tree

2 files changed

+5
-13
lines changed

2 files changed

+5
-13
lines changed

Zend/zend.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ ZEND_API int (*zend_post_startup_cb)(void) = NULL;
8383
ZEND_API void (*zend_post_shutdown_cb)(void) = NULL;
8484
ZEND_API int (*zend_preload_autoload)(zend_string *filename) = NULL;
8585

86+
/* This callback must be signal handler safe! */
8687
void (*zend_on_timeout)(int seconds);
8788

8889
static void (*zend_message_dispatcher_p)(zend_long message, const void *data);

Zend/zend_execute_API.c

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1164,15 +1164,6 @@ static void zend_timeout_handler(int dummy) /* {{{ */
11641164
#endif
11651165

11661166
if (zend_on_timeout) {
1167-
#ifdef ZEND_SIGNALS
1168-
/*
1169-
We got here because we got a timeout signal, so we are in a signal handler
1170-
at this point. However, we want to be able to timeout any user-supplied
1171-
shutdown functions, so pretend we are not in a signal handler while we are
1172-
calling these
1173-
*/
1174-
SIGG(running) = 0;
1175-
#endif
11761167
zend_on_timeout(EG(timeout_seconds));
11771168
}
11781169

@@ -1216,13 +1207,13 @@ static void zend_set_timeout_ex(zend_long seconds, int reset_signals) /* {{{ */
12161207
#ifdef ZEND_WIN32
12171208
zend_executor_globals *eg;
12181209

1219-
if(!seconds) {
1210+
if (!seconds) {
12201211
return;
12211212
}
12221213

1223-
/* Don't use ChangeTimerQueueTimer() as it will not restart an expired
1224-
timer, so we could end up with just an ignored timeout. Instead
1225-
delete and recreate. */
1214+
/* Don't use ChangeTimerQueueTimer() as it will not restart an expired
1215+
* timer, so we could end up with just an ignored timeout. Instead
1216+
* delete and recreate. */
12261217
if (NULL != tq_timer) {
12271218
if (!DeleteTimerQueueTimer(NULL, tq_timer, INVALID_HANDLE_VALUE)) {
12281219
tq_timer = NULL;

0 commit comments

Comments
 (0)