forked from Abc-Arbitrage/Disruptor-cpp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTestWaiter.cpp
More file actions
38 lines (31 loc) · 1.05 KB
/
Copy pathTestWaiter.cpp
File metadata and controls
38 lines (31 loc) · 1.05 KB
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
#include "stdafx.h"
#include "TestWaiter.h"
namespace Disruptor
{
namespace Tests
{
TestWaiter::TestWaiter(const std::shared_ptr< boost::barrier >& barrier,
const std::shared_ptr< ISequenceBarrier >& sequenceBarrier,
const std::shared_ptr< RingBuffer< StubEvent > >& ringBuffer,
std::int64_t initialSequence,
std::int64_t toWaitForSequence)
: m_barrier(barrier)
, m_sequenceBarrier(sequenceBarrier)
, m_ringBuffer(ringBuffer)
, m_initialSequence(initialSequence)
, m_toWaitForSequence(toWaitForSequence)
{
}
std::vector< StubEvent > TestWaiter::call() const
{
m_barrier->wait();
m_sequenceBarrier->waitFor(m_toWaitForSequence);
std::vector< StubEvent > events;
for (auto l = m_initialSequence; l <= m_toWaitForSequence; ++l)
{
events.push_back((*m_ringBuffer)[l]);
}
return events;
}
} // namespace Tests
} // namespace Disruptor