@@ -45,6 +45,7 @@ ZEND_API zend_fcall_info_cache empty_fcall_info_cache = { 0, NULL, NULL, NULL };
45
45
static WNDCLASS wc ;
46
46
static HWND timeout_window ;
47
47
static HANDLE timeout_thread_event ;
48
+ static HANDLE timeout_thread_handle ;
48
49
static DWORD timeout_thread_id ;
49
50
static int timeout_thread_initialized = 0 ;
50
51
#endif
@@ -1253,7 +1254,7 @@ static unsigned __stdcall timeout_thread_proc(void *pArgs)
1253
1254
void zend_init_timeout_thread ()
1254
1255
{
1255
1256
timeout_thread_event = CreateEvent (NULL , FALSE, FALSE, NULL );
1256
- _beginthreadex (NULL , 0 , timeout_thread_proc , NULL , 0 , & timeout_thread_id );
1257
+ timeout_thread_handle = _beginthreadex (NULL , 0 , timeout_thread_proc , NULL , 0 , & timeout_thread_id );
1257
1258
WaitForSingleObject (timeout_thread_event , INFINITE );
1258
1259
}
1259
1260
@@ -1264,6 +1265,10 @@ void zend_shutdown_timeout_thread()
1264
1265
return ;
1265
1266
}
1266
1267
PostThreadMessage (timeout_thread_id , WM_QUIT , 0 , 0 );
1268
+
1269
+ /* Wait for thread termination */
1270
+ WaitForSingleObject (timeout_thread_handle , 5000 );
1271
+ CloseHandle (timeout_thread_handle );
1267
1272
}
1268
1273
1269
1274
#endif
0 commit comments