hyperledger/iroha
Iroha - A simple, decentralized ledger http://iroha.tech
scheduler.hpp
Go to the documentation of this file.
1 
6 #ifndef IROHA_SUBSCRIPTION_SCHEDULER_HPP
7 #define IROHA_SUBSCRIPTION_SCHEDULER_HPP
8 
9 #include <functional>
10 
11 #include "common/common.hpp"
12 
13 namespace iroha::subscription {
14 
15  class IScheduler {
16  public:
17  using Task = std::function<void()>;
18  virtual ~IScheduler() {}
19 
21  virtual void dispose(bool wait_for_release = true) = 0;
22 
24  virtual bool isBusy() const = 0;
25 
27  virtual void add(Task &&t) = 0;
28 
30  virtual void addDelayed(std::chrono::microseconds timeout, Task &&t) = 0;
31  };
32 
33 } // namespace iroha::subscription
34 
35 #endif // IROHA_SUBSCRIPTION_SCHEDULER_HPP
Definition: scheduler.hpp:15
virtual void add(Task &&t)=0
Adds task to execution queue.
Definition: subscription_fwd.hpp:60
virtual void addDelayed(std::chrono::microseconds timeout, Task &&t)=0
Adds delayed task to execution queue.
virtual void dispose(bool wait_for_release=true)=0
Stops sheduler work and tasks execution.
std::function< void()> Task
Definition: scheduler.hpp:17
virtual ~IScheduler()
Definition: scheduler.hpp:18
virtual bool isBusy() const =0
Checks if current scheduler executes task.