Scheduler - removed templatization
Summary: Because it was unnecessary and also implemented wrong (if someone tried using a Schduler with something other then std::mutex, it would not compile). We can trivially add this if it ever becomes necessary. Reviewers: buda, mislav.bradac Reviewed By: buda, mislav.bradac Subscribers: pullbot Differential Revision: https://phabricator.memgraph.io/D666
This commit is contained in:
parent
e4dcfef91a
commit
a656ba3343
@ -115,9 +115,9 @@ class GraphDb {
|
|||||||
Snapshooter snapshooter_;
|
Snapshooter snapshooter_;
|
||||||
|
|
||||||
// Schedulers
|
// Schedulers
|
||||||
Scheduler<std::mutex> gc_scheduler_;
|
Scheduler gc_scheduler_;
|
||||||
Scheduler<std::mutex> snapshot_creator_;
|
Scheduler snapshot_creator_;
|
||||||
// Periodically wakes up and hints to transactions that are running for a long
|
// Periodically wakes up and hints to transactions that are running for a long
|
||||||
// time to stop their execution.
|
// time to stop their execution.
|
||||||
Scheduler<std::mutex> transaction_killer_;
|
Scheduler transaction_killer_;
|
||||||
};
|
};
|
||||||
|
@ -84,6 +84,6 @@ class Executioner {
|
|||||||
int64_t count_{0};
|
int64_t count_{0};
|
||||||
std::mutex execute_mutex_;
|
std::mutex execute_mutex_;
|
||||||
std::mutex update_mutex_;
|
std::mutex update_mutex_;
|
||||||
Scheduler<std::mutex> scheduler_;
|
Scheduler scheduler_;
|
||||||
std::vector<std::pair<int, std::function<void()>>> id_job_pairs_;
|
std::vector<std::pair<int, std::function<void()>>> id_job_pairs_;
|
||||||
};
|
};
|
||||||
|
@ -13,7 +13,6 @@
|
|||||||
* mutex class TMutex which is used to synchronize threads. Default template
|
* mutex class TMutex which is used to synchronize threads. Default template
|
||||||
* value is std::mutex.
|
* value is std::mutex.
|
||||||
*/
|
*/
|
||||||
template <typename TMutex = std::mutex>
|
|
||||||
class Scheduler {
|
class Scheduler {
|
||||||
public:
|
public:
|
||||||
Scheduler() {}
|
Scheduler() {}
|
||||||
@ -74,7 +73,7 @@ class Scheduler {
|
|||||||
/**
|
/**
|
||||||
* Mutex used to synchronize threads using condition variable.
|
* Mutex used to synchronize threads using condition variable.
|
||||||
*/
|
*/
|
||||||
TMutex mutex_;
|
std::mutex mutex_;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Condition variable is used to stop waiting until the end of the
|
* Condition variable is used to stop waiting until the end of the
|
||||||
|
@ -15,7 +15,7 @@ TEST(Scheduler, TestFunctionExecuting) {
|
|||||||
EXPECT_EQ(y.load(), x.load());
|
EXPECT_EQ(y.load(), x.load());
|
||||||
x++;
|
x++;
|
||||||
}};
|
}};
|
||||||
Scheduler<> scheduler;
|
Scheduler scheduler;
|
||||||
scheduler.Run(std::chrono::seconds(1), func);
|
scheduler.Run(std::chrono::seconds(1), func);
|
||||||
|
|
||||||
std::this_thread::sleep_for(std::chrono::milliseconds(980));
|
std::this_thread::sleep_for(std::chrono::milliseconds(980));
|
||||||
|
Loading…
Reference in New Issue
Block a user