diff options
author | Andris Zeila <andris.zeila@zabbix.com> | 2013-02-07 11:43:33 +0400 |
---|---|---|
committer | Andris Zeila <andris.zeila@zabbix.com> | 2013-02-07 11:43:33 +0400 |
commit | eec7ed6c801a15aa45aaef47f894de7018ca0483 (patch) | |
tree | d34fff7bf5cb334a098410426d3df2179fc16b06 /include | |
parent | a83892984dda3bd0ee9b72059e9cbebea73f935a (diff) |
...G...... [ZBX-3646] improved thread termination and resource cleanup in windows
Diffstat (limited to 'include')
-rw-r--r-- | include/threads.h | 6 |
1 files changed, 4 insertions, 2 deletions
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 */ |