void zbx_thread_start(ZBX_THREAD_ENTRY_POINTER(handler), zbx_thread_args_t *thread_args, ZBX_THREAD_HANDLE *thread);
#if defined(_WINDOWS) || defined(__MINGW32__)
void CALLBACK ZBXEndThread(ULONG_PTR dwParam);
#define ZBX_THREAD_ERROR 0
#define ZBX_THREAD_HANDLE HANDLE
#define ZBX_THREAD_HANDLE_NULL NULL
#define ZBX_THREAD_PRIORITY_NONE 0
#define ZBX_THREAD_ENTRY_POINTER(pointer_name) \
unsigned (__stdcall *pointer_name)(void *)
#define ZBX_THREAD_ENTRY(entry_name, arg_name) \
unsigned __stdcall entry_name(void *arg_name)
#define zbx_thread_exit(status) \
_endthreadex((unsigned int)(status)); \
return ((unsigned)(status))
#define zbx_sleep(sec) SleepEx(((DWORD)(sec)) * ((DWORD)1000), TRUE)
#define zbx_thread_kill(h) QueueUserAPC(ZBXEndThread, h, 0)
#define zbx_thread_kill_fatal(h) QueueUserAPC(ZBXEndThread, h, 0)
void zbx_child_fork(pid_t *pid);
#define ZBX_THREAD_ERROR -1
#define ZBX_THREAD_HANDLE pid_t
#define ZBX_THREAD_HANDLE_NULL 0
#define ZBX_THREAD_PRIORITY_NONE 0
#define ZBX_THREAD_PRIORITY_FIRST 1
#define ZBX_THREAD_PRIORITY_SECOND 2
#define ZBX_THREAD_PRIORITY_COUNT 3