File tree Expand file tree Collapse file tree 2 files changed +8
-6
lines changed Expand file tree Collapse file tree 2 files changed +8
-6
lines changed Original file line number Diff line number Diff line change 21
21
22
22
#include < functional>
23
23
#include < memory>
24
+ #include < atomic>
24
25
25
26
namespace Aws
26
27
{
@@ -163,8 +164,8 @@ namespace Aws
163
164
OnConnectionFailedHandler m_onConnectionFailed;
164
165
OnConnAckHandler m_onConnAck;
165
166
OnDisconnectHandler m_onDisconnect;
166
- int m_lastError;
167
- ConnectionState m_connectionState;
167
+ std::atomic< int > m_lastError;
168
+ std::atomic< ConnectionState> m_connectionState;
168
169
169
170
static void s_onConnectionFailed (aws_mqtt_client_connection* connection, int errorCode, void * userData);
170
171
static void s_onConnAck (aws_mqtt_client_connection* connection,
Original file line number Diff line number Diff line change @@ -181,9 +181,10 @@ namespace Aws
181
181
m_onConnectionFailed (std::move(toMove.m_onConnectionFailed)),
182
182
m_onConnAck (std::move(toMove.m_onConnAck)),
183
183
m_onDisconnect (std::move(toMove.m_onDisconnect)),
184
- m_lastError (toMove.m_lastError),
185
- m_connectionState (toMove.m_connectionState)
184
+ m_lastError (toMove.m_lastError.load() ),
185
+ m_connectionState (toMove.m_connectionState.load() )
186
186
{
187
+
187
188
toMove.m_owningClient = nullptr ;
188
189
toMove.m_underlyingConnection = nullptr ;
189
190
toMove.m_lastError = AWS_ERROR_UNKNOWN;
@@ -202,8 +203,8 @@ namespace Aws
202
203
m_onConnectionFailed = std::move (toMove.m_onConnectionFailed );
203
204
m_onConnAck = std::move (toMove.m_onConnAck );
204
205
m_onDisconnect = std::move (toMove.m_onDisconnect );
205
- m_lastError = toMove.m_lastError ;
206
- m_connectionState = toMove.m_connectionState ;
206
+ m_lastError = toMove.m_lastError . load () ;
207
+ m_connectionState = toMove.m_connectionState . load () ;
207
208
208
209
toMove.m_owningClient = nullptr ;
209
210
toMove.m_underlyingConnection = nullptr ;
You can’t perform that action at this time.
0 commit comments