]> granicus.if.org Git - php/commitdiff
Fixed bug #35612 (iis6 Access Violation crash)
authorDmitry Stogov <dmitry@php.net>
Fri, 9 Dec 2005 18:09:08 +0000 (18:09 +0000)
committerDmitry Stogov <dmitry@php.net>
Fri, 9 Dec 2005 18:09:08 +0000 (18:09 +0000)
Zend/zend_execute_API.c

index 5aecf8671f004bf2fb76064330daf26c9e44f2dd..028ba9e5eac1a4b937241241fdda0aff545f1fa7 100644 (file)
@@ -46,6 +46,7 @@ ZEND_API zend_fcall_info_cache empty_fcall_info_cache = { 0, NULL, NULL, NULL };
 static WNDCLASS wc;
 static HWND timeout_window;
 static HANDLE timeout_thread_event;
+static HANDLE timeout_thread_handle;
 static DWORD timeout_thread_id;
 static int timeout_thread_initialized=0;
 #endif
@@ -1346,7 +1347,7 @@ static unsigned __stdcall timeout_thread_proc(void *pArgs)
 void zend_init_timeout_thread()
 {
        timeout_thread_event = CreateEvent(NULL, FALSE, FALSE, NULL);
-       _beginthreadex(NULL, 0, timeout_thread_proc, NULL, 0, &timeout_thread_id);
+       timeout_thread_handle = _beginthreadex(NULL, 0, timeout_thread_proc, NULL, 0, &timeout_thread_id);
        WaitForSingleObject(timeout_thread_event, INFINITE);
 }
 
@@ -1357,6 +1358,10 @@ void zend_shutdown_timeout_thread()
                return;
        }
        PostThreadMessage(timeout_thread_id, WM_QUIT, 0, 0);
+
+       /* Wait for thread termination */
+       WaitForSingleObject(timeout_thread_handle, 5000);
+       CloseHandle(timeout_thread_handle);
 }
 
 #endif