Commit 5440bf64c1583e4e547dc6dbd0aca257b8b8b07b
1 parent
745d70b1
Added a lock for when we read the connect_state_.
Showing
1 changed file
with
4 additions
and
1 deletions
src/client.cpp
| @@ -93,7 +93,10 @@ bool Redox::connectUnix(const string &path, function<void(int)> connection_callb | @@ -93,7 +93,10 @@ bool Redox::connectUnix(const string &path, function<void(int)> connection_callb | ||
| 93 | } | 93 | } |
| 94 | 94 | ||
| 95 | // Return if succeeded | 95 | // Return if succeeded |
| 96 | - return connect_state_ == CONNECTED; | 96 | + { |
| 97 | + unique_lock<mutex> ul(connect_lock_); | ||
| 98 | + return connect_state_ == CONNECTED; | ||
| 99 | + } | ||
| 97 | } | 100 | } |
| 98 | 101 | ||
| 99 | void Redox::disconnect() { | 102 | void Redox::disconnect() { |