initial commit
This commit is contained in:
22
include/query_scheduler.hpp
Normal file
22
include/query_scheduler.hpp
Normal file
@@ -0,0 +1,22 @@
|
||||
#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_;
|
||||
};
|
||||
Reference in New Issue
Block a user