5 #include <libutl/host_thread.h> 6 #include <libutl/NamedObjectMI.h> 7 #include <libutl/RandUtils.h> 8 #include <libutl/Uint.h> 37 virtual const Object& getKey()
const;
43 static thread_handle_t handle();
70 return getFlag(flg_detached);
80 setFlag(flg_cancel,
true);
87 static void testCancel();
96 void* join(
bool deleteSelf =
true);
104 virtual void* run(
void* arg =
nullptr) = 0;
112 void start(
void* arg =
nullptr,
bool join =
true);
118 virtual void pause();
124 static void* tlsGet(
ulong_t key);
131 static void tlsSet(
ulong_t key,
void* value);
134 randutils::mt19937_64_rng* rng();
136 #if UTL_HOST_OS != UTL_OS_MINGW 137 void setAffinity(
size_t cpusetsize, cpu_set_t* cpuset);
140 static void utl_init();
142 static void utl_deInit();
145 virtual void onExit();
147 #if UTL_HOST_OS == UTL_OS_MINGW 148 static ulong_t __stdcall runThread(
void* vp_runThreadInfo);
150 static void* runThread(
void* vp_runThreadInfo);
157 setDetached(
bool detached)
159 setFlag(flg_detached, detached);
173 randutils::mt19937_64_rng* _rng;
174 #if UTL_HOST_OS == UTL_OS_MINGW 179 pthread_t _threadHandle;
180 static __thread
Thread* _thread;
void cancel()
Cancel the thread.
bool isDetached() const
Determine whether the thread is detached.
void deInit()
De-initialize UTL++.
Thread cancelled exception
Mix-in to provide 64-bits for space-efficient storage of up to 64 boolean flags.
size_t id() const
Get the thread's ID.
#define UTL_EXCEPTION_DECL(exName, baseExName)
Declare a simple exception type.
Root of UTL++ exception class hierarchy.
#define UTL_CLASS_DECL_ABC(DC, BC)
Declaration of standard UTL++ functionality for an abstract base class (ABC).
unsigned int uint_t
Unsigned integer.
unsigned long ulong_t
Unsigned long integer.
uint_t & node()
Get the thread's assigned node (NUMA).
#define UTL_CLASS_NO_COPY
Declare that a class cannot do copy().
Root of UTL++ class hierarchy.
uint_t node() const
Get the thread's assigned node (NUMA).
void init()
Initialize UTL++.