8 static DWORD WINAPI thread_fn(LPVOID param)
12 return thread->
fn(thread->
arg);
33 HANDLE handle = CreateThread(NULL, 0, thread_fn, thread, 0, &
id);
35 if (handle == INVALID_HANDLE_VALUE)
37 return GetLastError();
40 thread->
impl = handle;
52 if (WaitForSingleObject(thread->
impl, INFINITE) != WAIT_OBJECT_0)
54 return GetLastError();
59 if (GetExitCodeThread(thread->
impl, &result) == 0)
61 return GetLastError();
71 return GetCurrentThreadId();
#define STA_DECL
sal2 annotation on function implementations to copy annotations from the declaration
os_thread_id_t os_get_thread_id(void)
get the current thread id
unsigned os_status_t
thread return code
size_t os_thread_id_t
thread id
os_exitcode_t(* os_thread_fn_t)(void *arg)
#define CTASSERT(expr)
assert a condition, prints the condition as a message
STA_DECL os_error_t os_thread_join(os_thread_t *thread, os_status_t *status)
STA_DECL os_error_t os_thread_init(os_thread_t *thread, const char *name, os_thread_fn_t fn, void *arg)