210 void cancel() noexcept {pthread_cancel(thread);}
222 void join() noexcept {pthread_join(thread, 0);}
231 void detach() noexcept {pthread_detach(thread);}
247 bool is_caller() noexcept {
return pthread_equal(thread, pthread_self());}
372 class =
typename std::enable_if<!std::is_convertible<typename std::remove_reference<F>::type,
374 static std::unique_ptr<Cgu::Thread::Thread>
start(F&& func,
376 return start(Cgu::Callback::lambda<>(std::forward<F>(func)), joinable);
379 #ifdef CGU_USE_GLIB_MEMORY_SLICES_NO_COMPAT
475 std::unique_ptr<Cgu::Thread::Thread> thread;
745 static int block(
int& old_state) noexcept {
return pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &old_state);}
756 static int block() noexcept {
int old_state;
return block(old_state);}
773 static int unblock(
int& old_state) noexcept {
return pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, &old_state);}
799 int restore(
int& old_state) noexcept {
return pthread_setcancelstate(starting_state, &old_state);}
Action
Definition: thread.h:469
static std::unique_ptr< Cgu::Thread::Thread > start(F &&func, bool joinable)
Definition: thread.h:374
CancelBlock & operator=(const CancelBlock &)=delete
static int block() noexcept
Definition: thread.h:756
int restore(int &old_state) noexcept
Definition: thread.h:799
bool is_caller() noexcept
Definition: thread.h:247
JoinableHandle(std::unique_ptr< Cgu::Thread::Thread > thr, Action act)
Definition: thread.h:625
void detach() noexcept
Definition: thread.h:231
This file provides classes for type erasure.
A class wrapping a Thread::Thread object representing a joinable thread.
Definition: thread.h:467
void join() noexcept
Definition: thread.h:222
A class enabling the cancellation state of a thread to be controlled.
Definition: thread.h:718
A class which can be thrown to terminate the throwing thread.
Definition: thread.h:850
A wrapper class for pthread mutexes.
Definition: mutex.h:117
~CancelBlock()
Definition: thread.h:824
CancelBlock(const CancelBlock &)=delete
A class representing a pthread thread.
Definition: thread.h:166
Provides wrapper classes for pthread mutexes and condition variables, and scoped locking classes for ...
Definition: application.h:44
static int unblock() noexcept
Definition: thread.h:785
JoinableHandle(JoinableHandle &&h)
Definition: thread.h:652
Thread & operator=(const Thread &)=delete
JoinableHandle()
Definition: thread.h:664
int restore() noexcept
Definition: thread.h:808
void cancel() noexcept
Definition: thread.h:210
static std::unique_ptr< Cgu::Thread::Thread > start(const Cgu::Callback::Callback *cb, bool joinable)
JoinableHandle & operator=(JoinableHandle &&h)
The callback interface class.
Definition: callback.h:567
#define CGU_GLIB_MEMORY_SLICES_FUNCS
Definition: cgu_config.h:84
static int block(int &old_state) noexcept
Definition: thread.h:745
static int unblock(int &old_state) noexcept
Definition: thread.h:773