mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-07-24 15:54:45 +02:00
Should make debugger server more viable on Switch. Also fixes a leak.
23 lines
400 B
C++
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
|