Repository navigation
Expand file tree
/
Copy pathProcessingSequenceBarrier.h
More file actions
61 lines (42 loc) · 1.96 KB
/
Copy pathProcessingSequenceBarrier.h
File metadata and controls
61 lines (42 loc) · 1.96 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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#pragma once
#include <atomic>
#include "Disruptor/ISequenceBarrier.h"
#include "Disruptor/IWaitStrategy.h"
#include "Disruptor/Sequence.h"
namespace Disruptor
{
class IHighestPublishedSequenceProvider;
class ISequence;
class IWaitStrategy;
class Sequence;
/**
*
* ISequenceBarrier handed out for gating IEventProcessor on a cursor sequence and optional dependent IEventProcessors, using the given WaitStrategy.
*/
class ProcessingSequenceBarrier : public ISequenceBarrier, public std::enable_shared_from_this< ProcessingSequenceBarrier >
{
public:
ProcessingSequenceBarrier(const std::shared_ptr< IHighestPublishedSequenceProvider >& sequenceProvider,
const std::shared_ptr< IWaitStrategy >& waitStrategy,
const std::shared_ptr< Sequence >& cursorSequence,
const std::vector< std::shared_ptr< ISequence > >& dependentSequences);
std::int64_t waitFor(std::int64_t sequence) override;
std::int64_t cursor() override;
bool isAlerted() override;
void alert() override;
void clearAlert() override;
void checkAlert() override;
private:
static std::shared_ptr< ISequence > getDependentSequence(const std::shared_ptr< Sequence >& cursorSequence,
const std::vector< std::shared_ptr< ISequence > >& dependentSequences);
std::shared_ptr< IWaitStrategy > m_waitStrategy;
std::shared_ptr< ISequence > m_dependentSequence;
std::shared_ptr< Sequence > m_cursorSequence;
std::shared_ptr< IHighestPublishedSequenceProvider > m_sequenceProvider;
IWaitStrategy& m_waitStrategyRef;
ISequence& m_dependentSequenceRef;
Sequence& m_cursorSequenceRef;
IHighestPublishedSequenceProvider& m_sequenceProviderRef;
bool m_alerted;
};
} // namespace Disruptor