| 74 | bool joinable() const noexcept { return handle_.has_value(); } |
| 75 | |
| 76 | void join() |
| 77 | { |
| 78 | if (!joinable()) |
| 79 | { |
| 80 | throw std::system_error{ std::make_error_code( |
| 81 | std::errc::invalid_argument) }; |
| 82 | } |
| 83 | |
| 84 | int err = thrd_join(*handle_, nullptr); |
| 85 | if (err == thrd_error) |
| 86 | { |
| 87 | throw std::system_error{ std::make_error_code( |
| 88 | std::errc::no_such_process) }; |
| 89 | } |
| 90 | |
| 91 | handle_ = std::nullopt; |
| 92 | } |
| 93 | |
| 94 | void detach() |
| 95 | { |