forked from Abc-Arbitrage/Disruptor-cpp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStubPublisher.cpp
More file actions
40 lines (31 loc) · 736 Bytes
/
Copy pathStubPublisher.cpp
File metadata and controls
40 lines (31 loc) · 736 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
39
#include "stdafx.h"
#include "StubPublisher.h"
namespace Disruptor
{
namespace Tests
{
StubPublisher::StubPublisher(const std::shared_ptr< RingBuffer< TestEvent > >& ringBuffer)
: m_running(true)
, m_publicationCount(0)
{
m_ringBuffer = ringBuffer;
}
void StubPublisher::run()
{
while (m_running)
{
auto sequence = m_ringBuffer->next();
m_ringBuffer->publish(sequence);
++m_publicationCount;
}
}
std::int32_t StubPublisher::getPublicationCount() const
{
return m_publicationCount;
}
void StubPublisher::halt()
{
m_running = false;
}
} // namespace Tests
} // namespace Disruptor