]> granicus.if.org Git - php/commitdiff
Don't reset SIGG(running) when calling zend_on_timeout
authorNikita Popov <nikita.ppv@gmail.com>
Mon, 11 May 2020 13:05:01 +0000 (15:05 +0200)
committerNikita Popov <nikita.ppv@gmail.com>
Mon, 11 May 2020 13:05:01 +0000 (15:05 +0200)
This is only an internal callback nowadays and does not actually
run any user code. It must be async signal safe.

Zend/zend.c
Zend/zend_execute_API.c

index 40dd8991a1ea00e7cc2ad30bfba397efbdfe527a..e20a26f8b0c55a5b68851975080f711c17453e3d 100644 (file)
@@ -83,6 +83,7 @@ ZEND_API int (*zend_post_startup_cb)(void) = NULL;
 ZEND_API void (*zend_post_shutdown_cb)(void) = NULL;
 ZEND_API int (*zend_preload_autoload)(zend_string *filename) = NULL;
 
+/* This callback must be signal handler safe! */
 void (*zend_on_timeout)(int seconds);
 
 static void (*zend_message_dispatcher_p)(zend_long message, const void *data);
index d98db72fba5f1017daf430d2f1b7dff2ae78b601..bbd7bb8f8b98332e1b35f5f99de09e02ed1e233a 100644 (file)
@@ -1164,15 +1164,6 @@ static void zend_timeout_handler(int dummy) /* {{{ */
 #endif
 
        if (zend_on_timeout) {
-#ifdef ZEND_SIGNALS
-               /*
-                  We got here because we got a timeout signal, so we are in a signal handler
-                  at this point. However, we want to be able to timeout any user-supplied
-                  shutdown functions, so pretend we are not in a signal handler while we are
-                  calling these
-               */
-               SIGG(running) = 0;
-#endif
                zend_on_timeout(EG(timeout_seconds));
        }
 
@@ -1216,13 +1207,13 @@ static void zend_set_timeout_ex(zend_long seconds, int reset_signals) /* {{{ */
 #ifdef ZEND_WIN32
        zend_executor_globals *eg;
 
-       if(!seconds) {
+       if (!seconds) {
                return;
        }
 
-        /* Don't use ChangeTimerQueueTimer() as it will not restart an expired
-               timer, so we could end up with just an ignored timeout. Instead
-               delete and recreate. */
+       /* Don't use ChangeTimerQueueTimer() as it will not restart an expired
+        * timer, so we could end up with just an ignored timeout. Instead
+        * delete and recreate. */
        if (NULL != tq_timer) {
                if (!DeleteTimerQueueTimer(NULL, tq_timer, INVALID_HANDLE_VALUE)) {
                        tq_timer = NULL;