12typedef unsigned long long thread_id_type;
44 bool delete_after_termination;
45 static void* execute_s(
void* args);
54 void start(
bool _delete_after_termination =
false);
66 static void wait(
unsigned millisec);
81 static thread_id_type get_current_thread_id();
83 thread_id_type get_id()
const;
87extern CGV_API thread* start_in_thread(
void (*func)(thread_id_type),
bool _delete_after_termination =
false);
92#include <cgv/config/lib_end.h>
virtual void run()=0
thread function to override
static void wait(unsigned millisec)
wait the given number of milliseconds
void execute()
executes the run method
void stop()
try to stop the thread execution via indicating a stop request.
static void wait_for_signal(condition_mutex &cm)
sleep till the signal from the given condition_mutex is sent, lock the mutex first and unlock after w...
thread()
create the thread
static void wait_for_signal_with_lock(condition_mutex &cm)
prefered approach to wait for signal and implemented as { cm.lock(); wait_for_signal(cm); cm....
bool is_running()
return true if thread is running
void start(bool _delete_after_termination=false)
start the implemented run() method (asynchronly) and destruct the thread object
static bool wait_for_signal_or_timeout(condition_mutex &cm, unsigned millisec)
sleep till the signal from the given condition_mutex is sent or the timeout is reached,...
void wait_for_completion()
the thread is interpreted as a slave thread and started from another master thread.
static bool wait_for_signal_or_timeout_with_lock(condition_mutex &cm, unsigned millisec)
prefered approach to wait for signal or the timeout is reached and implemented as { cm....
bool have_stop_request()
check if there is a stop request
void kill()
kill a running thread
this header is dependency free
A mutex that can wake up other threads by signals sent when a condition is fulfilled.