cgv
Loading...
Searching...
No Matches
cgv::os::function_thread Class Reference
Inheritance diagram for cgv::os::function_thread:
cgv::os::thread cgv::os::thread

Public Member Functions

 function_thread (void(*_func)(thread_id_type))
 
void run ()
 thread function to override
 
 function_thread (void(*_func)(thread_id_type))
 
void run ()
 thread function to override
 
- Public Member Functions inherited from cgv::os::thread
 thread ()
 create the thread
 
virtual ~thread ()
 standard destructor (a running thread will be killed)
 
void start (bool _delete_after_termination=false)
 start the implemented run() method (asynchronly) and destruct the thread object
 
void stop ()
 try to stop the thread execution via indicating a stop request.
 
void kill ()
 kill a running thread
 
void wait_for_completion ()
 the thread is interpreted as a slave thread and started from another master thread.
 
bool is_running ()
 return true if thread is running
 
bool have_stop_request ()
 check if there is a stop request
 
thread_id_type get_id () const
 return id of this thread
 

Protected Attributes

void(* func )(thread_id_type)
 
- Protected Attributes inherited from cgv::os::thread
void * thread_ptr
 
bool stop_request
 
bool running
 
bool delete_after_termination
 

Additional Inherited Members

- Static Public Member Functions inherited from cgv::os::thread
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 waiting
 
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.unlock(); }
 
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, lock the mutex first and unlock after waiting
 
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.lock(); wait_for_signal_or_timeout(cm,millisec); cm.unlock(); }
 
static void wait (unsigned millisec)
 wait the given number of milliseconds
 
static thread_id_type get_current_thread_id ()
 return the id of the currently executed thread
 
- Protected Member Functions inherited from cgv::os::thread
void execute ()
 executes the run method
 
- Static Protected Member Functions inherited from cgv::os::thread
static void * execute_s (void *args)
 

Detailed Description

Definition at line 130 of file thread_pthread.h.

Constructor & Destructor Documentation

◆ function_thread() [1/2]

cgv::os::function_thread::function_thread ( void(*)(thread_id_type)  _func)
inline

Definition at line 135 of file thread_pthread.h.

◆ function_thread() [2/2]

cgv::os::function_thread::function_thread ( void(*)(thread_id_type)  _func)
inline

Definition at line 154 of file thread_std_thread.h.

Member Function Documentation

◆ run() [1/2]

void cgv::os::function_thread::run ( )
inlinevirtual

thread function to override

Implements cgv::os::thread.

Definition at line 139 of file thread_pthread.h.

References cgv::os::thread::get_id().

◆ run() [2/2]

void cgv::os::function_thread::run ( )
inlinevirtual

thread function to override

Implements cgv::os::thread.

Definition at line 158 of file thread_std_thread.h.

References cgv::os::thread::get_id().

Member Data Documentation

◆ func

void(* cgv::os::function_thread::func)(thread_id_type)
protected

Definition at line 133 of file thread_pthread.h.


The documentation for this class was generated from the following files: