Skip to content

Commit

Permalink
bool to atomic_bool
Browse files Browse the repository at this point in the history
  • Loading branch information
qicosmos committed Jun 12, 2019
1 parent 346dff6 commit 1820a5b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions include/rpc_client.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ namespace rest_rpc {
has_wait_ = true;
std::unique_lock<std::mutex> 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_;
}
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 1820a5b

Please sign in to comment.