From 449e7d18a22803fb220ba4bcc2c99e58cdb9f440 Mon Sep 17 00:00:00 2001 From: Dmitry Stogov Date: Fri, 10 Nov 2006 11:51:55 +0000 Subject: [PATCH] Start timiout thread on Windows only if necessary --- Zend/zend_execute_API.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c index 5dc9625d7a4..762b2c9fe8b 100644 --- a/Zend/zend_execute_API.c +++ b/Zend/zend_execute_API.c @@ -1521,6 +1521,9 @@ void zend_set_timeout(long seconds) TSRMLS_FETCH(); EG(timeout_seconds) = seconds; + if(!seconds) { + return; + } #ifdef ZEND_WIN32 if (timeout_thread_initialized==0 && InterlockedIncrement(&timeout_thread_initialized)==1) { /* We start up this process-wide thread here and not in zend_startup(), because if Zend @@ -1559,7 +1562,9 @@ void zend_set_timeout(long seconds) void zend_unset_timeout(TSRMLS_D) { #ifdef ZEND_WIN32 - PostThreadMessage(timeout_thread_id, WM_UNREGISTER_ZEND_TIMEOUT, (WPARAM) GetCurrentThreadId(), (LPARAM) 0); + if(timeout_thread_initialized) { + PostThreadMessage(timeout_thread_id, WM_UNREGISTER_ZEND_TIMEOUT, (WPARAM) GetCurrentThreadId(), (LPARAM) 0); + } #else # ifdef HAVE_SETITIMER {