From 1820a5b3dfc6bca29d006b7cf1259deb893b2d44 Mon Sep 17 00:00:00 2001 From: qicosmos Date: Wed, 12 Jun 2019 09:41:03 +0800 Subject: [PATCH] bool to atomic_bool --- include/rpc_client.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/rpc_client.hpp b/include/rpc_client.hpp index e6fc974..0cd84e6 100644 --- a/include/rpc_client.hpp +++ b/include/rpc_client.hpp @@ -154,7 +154,7 @@ namespace rest_rpc { has_wait_ = true; std::unique_lock lock(conn_mtx_); bool result = conn_cond_.wait_for(lock, std::chrono::seconds(timeout), - [this] {return has_connected_; }); + [this] {return has_connected_.load(); }); has_wait_ = false; return has_connected_; } @@ -524,7 +524,7 @@ namespace rest_rpc { size_t connect_timeout_ = 2000;//s size_t wait_timeout_ = 2;//s int reconnect_cnt_ = -1; - bool has_connected_ = false; + std::atomic_bool has_connected_ = { false }; std::mutex conn_mtx_; std::condition_variable conn_cond_; bool has_wait_ = false;