23 lines
397 B
C++
23 lines
397 B
C++
#pragma once
|
|
|
|
#include <functional>
|
|
#include <mutex>
|
|
|
|
class DaliQueryScheduler {
|
|
public:
|
|
static DaliQueryScheduler& instance() {
|
|
static DaliQueryScheduler inst;
|
|
return inst;
|
|
}
|
|
|
|
template <typename Fn>
|
|
auto run(Fn&& action) -> decltype(action()) {
|
|
std::lock_guard<std::mutex> lock(mu_);
|
|
return action();
|
|
}
|
|
|
|
private:
|
|
DaliQueryScheduler() = default;
|
|
std::mutex mu_;
|
|
};
|