summaryrefslogtreecommitdiff
path: root/src/clientiface.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/clientiface.h')
-rw-r--r--src/clientiface.h13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/clientiface.h b/src/clientiface.h
index 04e8b8033..3e7ba4793 100644
--- a/src/clientiface.h
+++ b/src/clientiface.h
@@ -27,6 +27,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "network/networkprotocol.h"
#include "network/address.h"
#include "porting.h"
+#include "threading/mutex_auto_lock.h"
#include <list>
#include <vector>
@@ -342,7 +343,7 @@ public:
u8 getMinor() const { return m_version_minor; }
u8 getPatch() const { return m_version_patch; }
const std::string &getFullVer() const { return m_full_version; }
-
+
void setLangCode(const std::string &code) { m_lang_code = code; }
const std::string &getLangCode() const { return m_lang_code; }
@@ -505,9 +506,13 @@ public:
static std::string state2Name(ClientState state);
protected:
- //TODO find way to avoid this functions
- void lock() { m_clients_mutex.lock(); }
- void unlock() { m_clients_mutex.unlock(); }
+ class AutoLock {
+ public:
+ AutoLock(ClientInterface &iface): m_lock(iface.m_clients_mutex) {}
+
+ private:
+ RecursiveMutexAutoLock m_lock;
+ };
RemoteClientMap& getClientList() { return m_clients; }