MCPcopy Create free account
hub / github.com/Extra-Creativity/Modern-Cpp-Basics / join

Method join

13-Multithreading/Answer-code/Thread.cpp:76–92  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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 {

Callers 1

mainFunction · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected