| 114 | } |
| 115 | |
| 116 | private: |
| 117 | template <class _Fun, class... _Args> |
| 118 | _LIBCPP_HIDE_FROM_ABI static thread __init_thread(const stop_source& __ss, _Fun&& __fun, _Args&&... __args) { |
| 119 | if constexpr (is_invocable_v<decay_t<_Fun>, stop_token, decay_t<_Args>...>) { |
| 120 | return thread(std::forward<_Fun>(__fun), __ss.get_token(), std::forward<_Args>(__args)...); |
| 121 | } else { |
| 122 | return thread(std::forward<_Fun>(__fun), std::forward<_Args>(__args)...); |
| 123 | } |
| 124 | } |
| 125 | |
| 126 | stop_source __stop_source_; |
| 127 | thread __thread_; |