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

Method detach

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

Source from the content-addressed store, hash-verified

92 }
93
94 void detach()
95 {
96 if (!joinable())
97 {
98 throw std::system_error{ std::make_error_code(
99 std::errc::invalid_argument) };
100 }
101
102 int err = thrd_detach(*handle_);
103 if (err == thrd_error)
104 {
105 throw std::system_error{ std::make_error_code(
106 std::errc::no_such_process) };
107 }
108
109 handle_ = std::nullopt;
110 }
111};
112
113template<>

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected