Files
ppsspp/ext/native/thread/executor.h
T
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

30 lines
564 B
C++

#pragma once
#include <functional>
#include <thread>
namespace threading {
// Stuff that can execute other stuff, like threadpools, should inherit from this.
class Executor {
public:
virtual void Run(std::function<void()> func) = 0;
virtual ~Executor() {}
};
class SameThreadExecutor : public Executor {
public:
void Run(std::function<void()> func) override;
};
class NewThreadExecutor : public Executor {
public:
~NewThreadExecutor() override;
void Run(std::function<void()> func) override;
private:
std::thread thread_;
};
} // namespace threading