32#ifndef ZYCORE_API_THREAD_H
33#define ZYCORE_API_THREAD_H
48#if defined(ZYAN_POSIX)
59typedef pthread_t ZyanThread;
73typedef pthread_key_t ZyanThreadTlsIndex;
78typedef void(*ZyanThreadTlsCallback)(
void* data);
87#define ZYAN_THREAD_DECLARE_TLS_CALLBACK(name, param_type, param_name) \
88 void name(param_type* param_name)
92#elif defined(ZYAN_WINDOWS)
103typedef HANDLE ZyanThread;
108typedef DWORD ZyanThreadId;
117typedef DWORD ZyanThreadTlsIndex;
122typedef PFLS_CALLBACK_FUNCTION ZyanThreadTlsCallback;
131#define ZYAN_THREAD_DECLARE_TLS_CALLBACK(name, param_type, param_name) \
132 VOID NTAPI name(param_type* param_name)
137# error "Unsupported platform detected"
199 ZyanThreadTlsCallback destructor);
General helper and platform detection macros.
#define ZYCORE_EXPORT
Symbol is exported in shared library builds.
Definition Defines.h:330
Status code definitions and check macros.
ZyanU32 ZyanStatus
Defines the ZyanStatus data type.
Definition Status.h:48
ZYCORE_EXPORT ZyanStatus ZyanThreadTlsGetValue(ZyanThreadTlsIndex index, void **data)
Returns the value inside the given Thread Local Storage (TLS) slot for the calling thread.
ZYCORE_EXPORT ZyanStatus ZyanThreadTlsSetValue(ZyanThreadTlsIndex index, void *data)
Set the value of the given Thread Local Storage (TLS) slot for the calling thread.
ZYCORE_EXPORT ZyanStatus ZyanThreadTlsFree(ZyanThreadTlsIndex index)
Releases a Thread Local Storage (TLS) slot.
ZYCORE_EXPORT ZyanStatus ZyanThreadTlsAlloc(ZyanThreadTlsIndex *index, ZyanThreadTlsCallback destructor)
Allocates a new Thread Local Storage (TLS) slot.
ZYCORE_EXPORT ZyanStatus ZyanThreadGetCurrentThread(ZyanThread *thread)
Returns the handle of the current thread.
ZYCORE_EXPORT ZyanStatus ZyanThreadGetCurrentThreadId(ZyanThreadId *thread_id)
Returns the unique id of the current thread.
uint64_t ZyanU64
Definition Types.h:219