1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Encapsulate envlock

This commit is contained in:
sfan5 2024-09-15 21:25:03 +02:00
parent 588a0f83e9
commit 0220d0d492
4 changed files with 31 additions and 22 deletions

View file

@ -424,8 +424,14 @@ public:
// Bind address
Address m_bind_addr;
// Environment mutex (envlock)
std::mutex m_env_mutex;
// Public helper for taking the envlock in a scope
class EnvAutoLock {
public:
EnvAutoLock(Server *server): m_lock(server->m_env_mutex) {}
private:
MutexAutoLock m_lock;
};
protected:
/* Do not add more members here, this is only required to make unit tests work. */
@ -600,6 +606,10 @@ private:
/*
Variables
*/
// Environment mutex (envlock)
std::mutex m_env_mutex;
// World directory
std::string m_path_world;
std::string m_path_mod_data;