Skip to content

Commit 2720908

Browse files
Fixed issue with race condition in Timer::Wait()
1 parent 102a1d1 commit 2720908

File tree

3 files changed

+15
-10
lines changed

3 files changed

+15
-10
lines changed

src/lib/Timer.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,11 @@ namespace sttp
8080
Stop();
8181
}
8282

83+
bool IsRunning() const
84+
{
85+
return m_running;
86+
}
87+
8388
int32_t GetInterval() const
8489
{
8590
return m_interval;
@@ -160,7 +165,7 @@ namespace sttp
160165

161166
void Wait() const
162167
{
163-
if (m_running && m_timerThread != nullptr)
168+
if (m_timerThread != nullptr)
164169
m_timerThread->join();
165170
}
166171

src/lib/Version.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
#define __VERSION_H
2626

2727
#define STTP_TITLE "STTP C++ Library"
28-
#define STTP_VERSION "1.0.12"
29-
#define STTP_UPDATEDON "2019-07-08"
28+
#define STTP_VERSION "1.0.13"
29+
#define STTP_UPDATEDON "2019-07-10"
3030

3131
#endif

src/samples/InstanceSubscribe/SubscriberHandler.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,17 +56,17 @@ void SubscriberHandler::SetupSubscriberConnector(SubscriberConnector& connector)
5656

5757
// TODO: Customize subscriber connector properties as desired...
5858

59-
//// Enable auto-reconnect sequence:
60-
connector.SetAutoReconnect(true);
59+
// Enable auto-reconnect sequence:
60+
//connector.SetAutoReconnect(true);
6161

62-
//// Set maximum number to attempt reconnection, -1 means never stop retrying connection attempts:
63-
connector.SetMaxRetries(-1);
62+
// Set maximum number to attempt reconnection, -1 means never stop retrying connection attempts:
63+
//connector.SetMaxRetries(-1);
6464

65-
//// Set number of initial milliseconds to wait before retrying connection attempt:
66-
connector.SetRetryInterval(5000);
65+
// Set number of initial milliseconds to wait before retrying connection attempt:
66+
//connector.SetRetryInterval(2000);
6767

6868
// Set maximum number of milliseconds to wait before retrying connection attempt, connection retry attempts use exponential back-off algorithm up to this defined maximum:
69-
connector.SetMaxRetryInterval(10000);
69+
//connector.SetMaxRetryInterval(30000);
7070
}
7171

7272
void SubscriberHandler::StatusMessage(const string& message)

0 commit comments

Comments
 (0)