Nebula
Loading...
Searching...
No Matches
linuxthreadlocaldata.h
Go to the documentation of this file.
1#pragma once
2//------------------------------------------------------------------------------
12#include "core/types.h"
13
14//------------------------------------------------------------------------------
15namespace Linux
16{
18{
19public:
21 static void SetupMainThread();
22
24 static IndexT RegisterSlot();
26 static void SetPointer(IndexT slot, void* ptr);
28 static void* GetPointer(IndexT slot);
30 static void ClearPointer(IndexT slot);
31
32private:
34 static void** GetThreadLocalTable();
35
36 static const int MaxNumSlots = 4096;
37 static pthread_key_t key;
38 static IndexT volatile slot;
39};
40
41} // namespace Linux
42//------------------------------------------------------------------------------
Thread local data storage class for platforms which don't have a proper __thread implementation but a...
Definition linuxthreadlocaldata.h:18
static void * GetPointer(IndexT slot)
get thread local pointer value
Definition linuxthreadlocaldata.cc:89
static pthread_key_t key
Definition linuxthreadlocaldata.h:37
static IndexT RegisterSlot()
register a new slot, this is usually called from the main thread
Definition linuxthreadlocaldata.cc:64
static void SetupMainThread()
setup the object from the main thread (call from SysFunc::Setup())
Definition linuxthreadlocaldata.cc:47
static IndexT volatile slot
Definition linuxthreadlocaldata.h:38
static void SetPointer(IndexT slot, void *ptr)
set thread local pointer value (must only be called once)
Definition linuxthreadlocaldata.cc:76
static void ClearPointer(IndexT slot)
clear pointer (must only be called after SetPointer)
Definition linuxthreadlocaldata.cc:101
static const int MaxNumSlots
Definition linuxthreadlocaldata.h:36
static void ** GetThreadLocalTable()
get pointer to thread locale data table, create table if this is the first call for this thread
Definition linuxthreadlocaldata.cc:22
Definition linuxcompletioncounter.h:15
int IndexT
Definition types.h:48