12#include <cx/thread/threadobj.h>
43_Ret_opt_valid_ _Check_return_ Thread*
44_thrCreate(_In_ threadFunc func, _In_ strref name,
int n, _In_
stvar args[],
bool ui);
49#define thrCreate(func, name, ...) \
50 _thrCreate(func, name, count_macro_args(__VA_ARGS__), (stvar[]) { __VA_ARGS__ }, false)
51#define thrCreateUI(func, name, ...) \
52 _thrCreate(func, name, count_macro_args(__VA_ARGS__), (stvar[]) { __VA_ARGS__ }, true)
54void _thrRun(_In_ threadFunc func, _In_ strref name,
int n, _In_
stvar args[]);
66#define thrRun(func, name, ...) \
67 _thrRun(func, name, count_macro_args(__VA_ARGS__), (stvar[]) { __VA_ARGS__ })
74 return atomicLoad(
bool, &thread->running, Acquire);
96_meta_inline
bool thrLoop(_In_ Thread* thread)
98 return !atomicLoad(
bool, &thread->requestExit, Acquire);
119bool thrWait(_In_ Thread* thread, int64 timeout);
138bool _thrPlatformSetPriority(_Inout_ Thread* thread,
int prio);
146#define thrSetPriority(thread, prio) _thrPlatformSetPriority(thread, THREAD_##prio)
154#define thrSetPriorityV(thread, prio) _thrPlatformSetPriority(thread, prio)
164#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)