source: ntrip/trunk/GnssCenter/thrift/rtnet_sdo_example/ConnectionRequiredRunnable.cpp@ 9337

Last change on this file since 9337 was 4941, checked in by mervart, 12 years ago
File size: 1.1 KB
Line 
1#include "ConnectionRequiredRunnable.h"
2
3using namespace apache::thrift::concurrency;
4using std::string;
5
6ConnectionRequiredRunnable::ConnectionRequiredRunnable(boost::shared_ptr<ConnectionStatusMonitor>& connectionMonitor, const string& name)
7 : connectionMonitor_(connectionMonitor),
8 threadName_(name),
9 connectMonitor_(),
10 disconnectMonitor_(),
11 stop_(false)
12{
13}
14
15void
16ConnectionRequiredRunnable::connectionLost()
17{
18}
19
20void
21ConnectionRequiredRunnable::connectionEstablished()
22{
23 connectMonitor_.notifyAll();
24}
25
26void
27ConnectionRequiredRunnable::disconnected()
28{
29 connectionMonitor_->disconnected(this);
30 disconnectMonitor_.notifyAll();
31}
32
33void
34ConnectionRequiredRunnable::connectWait()
35{
36 if (connectionMonitor_->connected()) return;
37 connectMonitor_.waitForever();
38}
39
40void
41ConnectionRequiredRunnable::disconnectWait()
42{
43 if (!connectionMonitor_->connected()) return;
44 disconnectMonitor_.waitForever();
45}
46
47void
48ConnectionRequiredRunnable::stop()
49{
50 stop_ = true;
51 connectMonitor_.notifyAll();
52 disconnectMonitor_.notifyAll();
53}
54
Note: See TracBrowser for help on using the repository browser.