http: Avoid detach() in webserver code.

Should make debugger server more viable on Switch.  Also fixes a leak.
This commit is contained in:
Unknown W. Brackets committed 2020-03-03 23:08:34 -08:00
1 parent cb1b7b1e43
commit 11e828053b
4 files changed
+19 -2

No files matched your search

+7 -1
View File
@@ -10,7 +10,13 @@ void SameThreadExecutor::Run(std::function<void()> func) {
}
void NewThreadExecutor::Run(std::function<void()> func) {
std::thread(func).detach();
thread_ = std::thread(func);
}
NewThreadExecutor::~NewThreadExecutor() {
// If Run was ever called...
if (thread_.joinable())
thread_.join();
}
} // namespace threading