210 void cancel() noexcept {pthread_cancel(thread);}
221 void join() noexcept {pthread_join(thread, 0);}
230 void detach() noexcept {pthread_detach(thread);}
246 bool is_caller() noexcept {
return pthread_equal(thread, pthread_self());}
371 class =
typename std::enable_if<!std::is_convertible<typename std::remove_reference<F>::type,
373 static std::unique_ptr<Cgu::Thread::Thread>
start(F&& func,
375 return start(Cgu::Callback::lambda<>(std::forward<F>(func)), joinable);
378 #ifdef CGU_USE_GLIB_MEMORY_SLICES_NO_COMPAT
473 std::unique_ptr<Cgu::Thread::Thread> thread;
623 JoinableHandle(std::unique_ptr<Cgu::Thread::Thread> thr,
Action act): action(act), detached(false), thread(std::move(thr)) {}
743 static int block(
int& old_state) noexcept {
return pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &old_state);}
754 static int block() noexcept {
int old_state;
return block(old_state);}
771 static int unblock(
int& old_state) noexcept {
return pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, &old_state);}
797 int restore(
int& old_state) noexcept {
return pthread_setcancelstate(starting_state, &old_state);}