mirror of
https://github.com/izzy2lost/ppsspp.git
synced 2026-03-10 12:43:04 -07:00
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
|