1
#pragma once
2

            
3
#include "envoy/event/schedulable_cb.h"
4

            
5
#include "source/common/event/event_impl_base.h"
6
#include "source/common/event/libevent.h"
7

            
8
namespace Envoy {
9
namespace Event {
10

            
11
class DispatcherImpl;
12

            
13
/**
14
 * libevent implementation of SchedulableCallback.
15
 */
16
class SchedulableCallbackImpl : public SchedulableCallback, ImplBase {
17
public:
18
  SchedulableCallbackImpl(Libevent::BasePtr& libevent, std::function<void()> cb);
19

            
20
  // SchedulableCallback implementation.
21
  void scheduleCallbackCurrentIteration() override;
22
  void scheduleCallbackNextIteration() override;
23
  void cancel() override;
24
  bool enabled() override;
25

            
26
private:
27
  std::function<void()> cb_;
28
};
29

            
30
} // namespace Event
31
} // namespace Envoy