24 #include "threading.h" 30 BEGIN_NAMESPACE_THREADING
32 enum class ThreadExPriority : int
88 std::recursive_mutex&
getLock();
126 std::recursive_mutex lock;
127 std::atomic<bool> terminated;
128 std::atomic<bool> finished;
142 std::unique_ptr<std::thread> currentThread;
143 ThreadExPriority priority;
147 END_NAMESPACE_THREADING
void waitFor()
Waits for the thread to terminate.
ThreadEx class for working with threads.
Definition: threadex.h:46
const std::thread::id getThreadId() const
Returns thread id.
bool getStarted() const
Returns true if thread is started.
void setExceptionAdapter(ThreadExceptionAdapter *exceptionAdapter)
Sets exception information holder.
void terminate()
Terminate sets the thread's Terminated property to true, signaling that the thread should be terminat...
Wraps exception_ptr to deliver exception propagation from thread to the main thread.
Definition: threadexceptionadapter.h:23
An adapter managing exception_ptr useful for exception handling in threads.
virtual void stop()
Terminate and wait for the thread to terminate.
void setThreadName(const char *name)
Set current thread name (you must call it from the thread)
virtual void start()
Starts the execution of a thread.
const ThreadExPriority & getPriority() const
Get thread's scheduling priority relative to other threads in the process.
std::recursive_mutex & getLock()
Get thread's locking object.
ThreadExceptionAdapter * getExceptionAdapter()
Returns exception information holder.
const std::atomic< bool > & getTerminated() const
Returns thread's terminated signal.
void setPriority(ThreadExPriority priority)
Set thread's scheduling priority relative to other threads in the process.
virtual void execute()=0
Provides an abstract or pure virtual method to contain the code which executes when the thread is run...
const std::atomic< bool > & getFinished() const
Returns true if thread has already been finished.