forked from Abc-Arbitrage/Disruptor-cpp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFunctionEventHandler.h
More file actions
38 lines (26 loc) · 933 Bytes
/
Copy pathFunctionEventHandler.h
File metadata and controls
38 lines (26 loc) · 933 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#pragma once
#include <memory>
#include "Disruptor/IEventHandler.h"
#include "Disruptor.TestTools/ManualResetEvent.h"
#include "Disruptor.PerfTests/FunctionEvent.h"
#include "Disruptor.PerfTests/FunctionStep.h"
#include "Disruptor.PerfTests/PaddedLong.h"
namespace Disruptor
{
namespace PerfTests
{
class FunctionEventHandler : public IEventHandler< FunctionEvent >
{
public:
explicit FunctionEventHandler(FunctionStep functionStep);
std::int64_t stepThreeCounter() const;
void reset(const std::shared_ptr< Tests::ManualResetEvent >& latch, std::int64_t iterations);
void onEvent(FunctionEvent& data, std::int64_t sequence, bool endOfBatch);
private:
FunctionStep m_functionStep;
PaddedLong m_counter;
std::int64_t m_iterations{0};
std::shared_ptr< Tests::ManualResetEvent > m_latch;
};
} // namespace PerfTests
} // namespace Disruptor