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:
florijan 2017-08-17 09:19:58 +02:00
parent e4dcfef91a
commit a656ba3343
4 changed files with 6 additions and 7 deletions

View File

@ -115,9 +115,9 @@ class GraphDb {
Snapshooter snapshooter_;
// Schedulers
Scheduler<std::mutex> gc_scheduler_;
Scheduler<std::mutex> snapshot_creator_;
Scheduler gc_scheduler_;
Scheduler snapshot_creator_;
// Periodically wakes up and hints to transactions that are running for a long
// time to stop their execution.
Scheduler<std::mutex> transaction_killer_;
Scheduler transaction_killer_;
};

View File

@ -84,6 +84,6 @@ class Executioner {
int64_t count_{0};
std::mutex execute_mutex_;
std::mutex update_mutex_;
Scheduler<std::mutex> scheduler_;
Scheduler scheduler_;
std::vector<std::pair<int, std::function<void()>>> id_job_pairs_;
};

View File

@ -13,7 +13,6 @@
* mutex class TMutex which is used to synchronize threads. Default template
* value is std::mutex.
*/
template <typename TMutex = std::mutex>
class Scheduler {
public:
Scheduler() {}
@ -74,7 +73,7 @@ class Scheduler {
/**
* 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

View File

@ -15,7 +15,7 @@ TEST(Scheduler, TestFunctionExecuting) {
EXPECT_EQ(y.load(), x.load());
x++;
}};
Scheduler<> scheduler;
Scheduler scheduler;
scheduler.Run(std::chrono::seconds(1), func);
std::this_thread::sleep_for(std::chrono::milliseconds(980));