From eec7ed6c801a15aa45aaef47f894de7018ca0483 Mon Sep 17 00:00:00 2001 From: Andris Zeila Date: Thu, 7 Feb 2013 07:43:33 +0000 Subject: ...G...... [ZBX-3646] improved thread termination and resource cleanup in windows --- include/threads.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'include/threads.h') diff --git a/include/threads.h b/include/threads.h index 0d380322169..80b05546684 100644 --- a/include/threads.h +++ b/include/threads.h @@ -23,6 +23,8 @@ #include "common.h" #if defined(_WINDOWS) + /* the ZBXEndThread function is implemented in service.c file */ + void CALLBACK ZBXEndThread(ULONG_PTR dwParam); #define ZBX_THREAD_ERROR 0 @@ -39,9 +41,9 @@ _endthreadex((unsigned int)(status)); \ return ((unsigned)(status)) - #define zbx_sleep(sec) Sleep(((DWORD)(sec)) * ((DWORD)1000)) + #define zbx_sleep(sec) SleepEx(((DWORD)(sec)) * ((DWORD)1000), TRUE) - #define zbx_thread_kill(h) TerminateThread(h, SUCCEED); + #define zbx_thread_kill(h) QueueUserAPC(ZBXEndThread, h, 0); #else /* not _WINDOWS */ -- cgit v1.2.3