7#ifdef __cpp_lib_jthread
17#ifdef __cpp_lib_jthread
18 using jthread = std::jthread;
28 template<
typename Function,
typename... Args>
29 requires std::invocable<Function,
stop_token, Args&&...>
32 thread_{std::forward<Function>(f), stop_source_.get_token(), std::forward<Args>(args)...}
49 std::swap(stop_source_, other.stop_source_);
50 std::swap(thread_, other.thread_);
65 return thread_.joinable();
75 return thread_.join();
jthread(Function &&f, Args &&... args)
Definition thread.h:30
jthread & operator=(jthread const &)=delete
jthread(jthread const &)=delete
~jthread() noexcept
Definition thread.h:55
bool joinable() const noexcept
Definition thread.h:63
jthread(jthread &&) noexcept=default
bool request_stop() noexcept
Definition thread.h:68
void join()
Definition thread.h:73
Definition stop_token.h:40
bool request_stop() noexcept
Definition stop_token.h:49
Definition stop_token.h:19
Definition stop_token.h:14