summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@php.net>2006-11-10 11:49:35 +0000
committerDmitry Stogov <dmitry@php.net>2006-11-10 11:49:35 +0000
commit011e0cde62607af47fd91595b4e59855bc232102 (patch)
tree144952ac98f0a126eab755120dadb9e0cba8d7c9
parent532b02cd1934d227b08f7af4d42fd061dc4486a0 (diff)
downloadphp-git-011e0cde62607af47fd91595b4e59855bc232102.tar.gz
Start timiout thread on Windows only if necessary
-rw-r--r--NEWS1
-rw-r--r--Zend/zend_execute_API.c7
2 files changed, 7 insertions, 1 deletions
diff --git a/NEWS b/NEWS
index 774f495c7e..4c5a0e40bc 100644
--- a/NEWS
+++ b/NEWS
@@ -8,6 +8,7 @@ PHP NEWS
. implemented registry cache that prevent registry lookup on each request.
In case of modification of corresponding registry-tree PHP will reload
it automatic
+ . start timiout thread only if necessary
- Zend Memory Manager Improvements (Dmitry)
. use HeapAlloc() instead of VirtualAlloc()
. use "win32" storage manager (instead of "malloc") on Windows by default
diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c
index 2c1105c7e0..0a0fba1f6f 100644
--- a/Zend/zend_execute_API.c
+++ b/Zend/zend_execute_API.c
@@ -1381,6 +1381,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
@@ -1419,7 +1422,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
{