forked from Abc-Arbitrage/Disruptor-cpp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTimeoutBlockingWaitStrategy.h
More file actions
38 lines (28 loc) · 966 Bytes
/
TimeoutBlockingWaitStrategy.h
File metadata and controls
38 lines (28 loc) · 966 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 <boost/thread.hpp>
#include "Disruptor/ClockConfig.h"
#include "Disruptor/IWaitStrategy.h"
namespace Disruptor
{
class TimeoutBlockingWaitStrategy : public IWaitStrategy
{
public:
explicit TimeoutBlockingWaitStrategy(ClockConfig::Duration timeout);
/**
* \see IWaitStrategy.waitFor
*/
std::int64_t waitFor(std::int64_t sequence,
Sequence& cursor,
ISequence& dependentSequence,
ISequenceBarrier& barrier) override;
/**
* \see IWaitStrategy.signalAllWhenBlocking
*/
void signalAllWhenBlocking() override;
void writeDescriptionTo(std::ostream& stream) const override;
private:
ClockConfig::Duration m_timeout;
boost::recursive_mutex m_gate;
boost::condition_variable_any m_conditionVariable;
};
} // namespace Disruptor