12#include <cx/thread/threadobj.h>
45_Ret_opt_valid_ _Check_return_ Thread*
46_thrCreate(_In_ threadFunc func, _In_ strref name,
int n, _In_
stvar args[],
bool ui);
51#define thrCreate(func, name, ...) \
52 _thrCreate(func, name, count_macro_args(__VA_ARGS__), (stvar[]) { __VA_ARGS__ }, false)
53#define thrCreateUI(func, name, ...) \
54 _thrCreate(func, name, count_macro_args(__VA_ARGS__), (stvar[]) { __VA_ARGS__ }, true)
56void _thrRun(_In_ threadFunc func, _In_ strref name,
int n, _In_
stvar args[]);
68#define thrRun(func, name, ...) \
69 _thrRun(func, name, count_macro_args(__VA_ARGS__), (stvar[]) { __VA_ARGS__ })
76 return atomicLoad(
bool, &thread->running, Acquire);
98_meta_inline
bool thrLoop(_In_ Thread* thread)
100 return !atomicLoad(
bool, &thread->requestExit, Acquire);
121bool thrWait(_In_ Thread* thread, int64 timeout);
140bool _thrPlatformSetPriority(_Inout_ Thread* thread,
int prio);
148#define thrSetPriority(thread, prio) _thrPlatformSetPriority(thread, THREAD_##prio)
156#define thrSetPriorityV(thread, prio) _thrPlatformSetPriority(thread, prio)
166#define thrRelease(pthread) objRelease(pthread)
Compiler and platform detection macros.
#define stvar(typen, val)
bool thrLoop(Thread *thread)
int thrShutdownMany(sa_Thread threads)
intptr thrOSThreadID(Thread *thread)
Thread * thrCurrent(void)
bool thrShutdown(Thread *thread)
bool thrRunning(Thread *thread)
intptr thrCurrentOSThreadID(void)
ThreadPriority
Thread scheduling priority levels.
void thrRegisterSysThread(Thread *thread)
bool thrRequestExit(Thread *thread)
bool thrWait(Thread *thread, int64 timeout)
@ THREAD_Normal
Normal priority (default)
@ THREAD_Idle
Idle priority (only runs when system is idle)
@ THREAD_High
High priority.
@ THREAD_Higher
Higher priority.
@ THREAD_Batch
Batch processing priority (below normal)
@ THREAD_Low
Low priority.
@ THREAD_Realtime
Real-time priority (use with caution)