Files
ppsspp/ext/native/thread/executor.cpp
Unknown W. Brackets 11e828053b http: Avoid detach() in webserver code.
Should make debugger server more viable on Switch.  Also fixes a leak.
2020-03-03 23:08:34 -08:00

23 lines
400 B
C++

#include "thread/executor.h"
#include <functional>
#include <thread>
namespace threading {
void SameThreadExecutor::Run(std::function<void()> func) {
func();
}
void NewThreadExecutor::Run(std::function<void()> func) {
thread_ = std::thread(func);
}
NewThreadExecutor::~NewThreadExecutor() {
// If Run was ever called...
if (thread_.joinable())
thread_.join();
}
} // namespace threading