CatapultServer  v0.5.0.1 (Elephant)
DisruptorBarrier.h
Go to the documentation of this file.
1 
21 #pragma once
22 #include "DisruptorTypes.h"
23 #include "catapult/utils/Logging.h"
24 #include <atomic>
25 #include <stddef.h>
26 #include <stdint.h>
27 
28 namespace catapult { namespace disruptor {
29 
33  public:
36  : m_level(level)
38  {}
39 
41  inline void advance() {
42  ++m_position;
43  }
44 
46  inline size_t level() const {
47  return m_level;
48  }
49 
51  inline PositionType position() const {
52  return m_position;
53  }
54 
55  private:
56  const size_t m_level;
57  std::atomic<PositionType> m_position;
58  };
59 }}
catapult::disruptor::PositionType
uint64_t PositionType
Position within disruptor components.
Definition: DisruptorTypes.h:29
catapult::disruptor::DisruptorBarrier::m_position
std::atomic< PositionType > m_position
Definition: DisruptorBarrier.h:57
catapult::disruptor::DisruptorBarrier::advance
void advance()
Advances the barrier.
Definition: DisruptorBarrier.h:41
catapult::disruptor::DisruptorBarrier::level
size_t level() const
Returns level of the barrier.
Definition: DisruptorBarrier.h:46
DisruptorTypes.h
catapult::disruptor::DisruptorBarrier::m_level
const size_t m_level
Definition: DisruptorBarrier.h:56
catapult::disruptor::DisruptorBarrier::DisruptorBarrier
DisruptorBarrier(size_t level, PositionType position)
Creates a barrier given its level and position (barrierEndPosition).
Definition: DisruptorBarrier.h:35
catapult::disruptor::DisruptorBarrier::position
PositionType position() const
Returns position of the barrier.
Definition: DisruptorBarrier.h:51
catapult
Definition: AddressExtractionExtension.cpp:28
Logging.h
catapult::disruptor::DisruptorBarrier
Definition: DisruptorBarrier.h:32