Use C++11 mutexes only (remove compat code) (#5922)
* Fix event LINT & remove default constructor/destructors * remove compat code & modernize autolock headermaster
parent
8bdde45895
commit
d4c0f91275
|
@ -22,10 +22,10 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
|
||||||
#include "util/string.h"
|
#include "util/string.h"
|
||||||
#include "threading/thread.h"
|
#include "threading/thread.h"
|
||||||
#include "threading/mutex.h"
|
|
||||||
#include "exceptions.h"
|
#include "exceptions.h"
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <mutex>
|
||||||
|
|
||||||
class BanManager
|
class BanManager
|
||||||
{
|
{
|
||||||
|
@ -43,7 +43,7 @@ public:
|
||||||
bool isModified();
|
bool isModified();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Mutex m_mutex;
|
std::mutex m_mutex;
|
||||||
std::string m_banfilepath;
|
std::string m_banfilepath;
|
||||||
StringMap m_ips;
|
StringMap m_ips;
|
||||||
bool m_modified;
|
bool m_modified;
|
||||||
|
|
|
@ -23,7 +23,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
#include "network/connection.h"
|
#include "network/connection.h"
|
||||||
#include "clientenvironment.h"
|
#include "clientenvironment.h"
|
||||||
#include "irrlichttypes_extrabloated.h"
|
#include "irrlichttypes_extrabloated.h"
|
||||||
#include "threading/mutex.h"
|
|
||||||
#include <ostream>
|
#include <ostream>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <set>
|
#include <set>
|
||||||
|
|
|
@ -657,7 +657,7 @@ void ClientLauncher::speed_tests()
|
||||||
infostream << "Around 5000/ms should do well here." << std::endl;
|
infostream << "Around 5000/ms should do well here." << std::endl;
|
||||||
TimeTaker timer("Testing mutex speed");
|
TimeTaker timer("Testing mutex speed");
|
||||||
|
|
||||||
Mutex m;
|
std::mutex m;
|
||||||
u32 n = 0;
|
u32 n = 0;
|
||||||
u32 i = 0;
|
u32 i = 0;
|
||||||
do {
|
do {
|
||||||
|
|
|
@ -417,7 +417,7 @@ private:
|
||||||
// Maps a texture name to an index in the former.
|
// Maps a texture name to an index in the former.
|
||||||
std::map<std::string, u32> m_name_to_id;
|
std::map<std::string, u32> m_name_to_id;
|
||||||
// The two former containers are behind this mutex
|
// The two former containers are behind this mutex
|
||||||
Mutex m_textureinfo_cache_mutex;
|
std::mutex m_textureinfo_cache_mutex;
|
||||||
|
|
||||||
// Queued texture fetches (to be processed by the main thread)
|
// Queued texture fetches (to be processed by the main thread)
|
||||||
RequestQueue<std::string, u32, u8, u8> m_get_texture_queue;
|
RequestQueue<std::string, u32, u8, u8> m_get_texture_queue;
|
||||||
|
|
|
@ -23,13 +23,13 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
|
||||||
#include "constants.h"
|
#include "constants.h"
|
||||||
#include "serialization.h" // for SER_FMT_VER_INVALID
|
#include "serialization.h" // for SER_FMT_VER_INVALID
|
||||||
#include "threading/mutex.h"
|
|
||||||
#include "network/networkpacket.h"
|
#include "network/networkpacket.h"
|
||||||
#include "porting.h"
|
#include "porting.h"
|
||||||
|
|
||||||
#include <list>
|
#include <list>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <set>
|
#include <set>
|
||||||
|
#include <mutex>
|
||||||
|
|
||||||
class MapBlock;
|
class MapBlock;
|
||||||
class ServerEnvironment;
|
class ServerEnvironment;
|
||||||
|
@ -508,14 +508,14 @@ private:
|
||||||
|
|
||||||
// Connection
|
// Connection
|
||||||
con::Connection* m_con;
|
con::Connection* m_con;
|
||||||
Mutex m_clients_mutex;
|
std::mutex m_clients_mutex;
|
||||||
// Connected clients (behind the con mutex)
|
// Connected clients (behind the con mutex)
|
||||||
RemoteClientMap m_clients;
|
RemoteClientMap m_clients;
|
||||||
std::vector<std::string> m_clients_names; //for announcing masterserver
|
std::vector<std::string> m_clients_names; //for announcing masterserver
|
||||||
|
|
||||||
// Environment
|
// Environment
|
||||||
ServerEnvironment *m_env;
|
ServerEnvironment *m_env;
|
||||||
Mutex m_env_mutex;
|
std::mutex m_env_mutex;
|
||||||
|
|
||||||
float m_print_info_timer;
|
float m_print_info_timer;
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include "threading/mutex.h"
|
|
||||||
#include "threading/mutex_auto_lock.h"
|
#include "threading/mutex_auto_lock.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
|
@ -152,7 +151,7 @@ void DebugStack::print(std::ostream &os, bool everything)
|
||||||
// pthread_t, but it isn't too important since none of our supported platforms
|
// pthread_t, but it isn't too important since none of our supported platforms
|
||||||
// implement pthread_t as a non-ordinal type.
|
// implement pthread_t as a non-ordinal type.
|
||||||
std::map<threadid_t, DebugStack*> g_debug_stacks;
|
std::map<threadid_t, DebugStack*> g_debug_stacks;
|
||||||
Mutex g_debug_stacks_mutex;
|
std::mutex g_debug_stacks_mutex;
|
||||||
|
|
||||||
void debug_stacks_init()
|
void debug_stacks_init()
|
||||||
{
|
{
|
||||||
|
|
|
@ -21,6 +21,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
#define EMERGE_HEADER
|
#define EMERGE_HEADER
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
|
#include <mutex>
|
||||||
#include "irr_v3d.h"
|
#include "irr_v3d.h"
|
||||||
#include "util/container.h"
|
#include "util/container.h"
|
||||||
#include "mapgen.h" // for MapgenParams
|
#include "mapgen.h" // for MapgenParams
|
||||||
|
@ -155,7 +156,7 @@ private:
|
||||||
std::vector<EmergeThread *> m_threads;
|
std::vector<EmergeThread *> m_threads;
|
||||||
bool m_threads_active;
|
bool m_threads_active;
|
||||||
|
|
||||||
Mutex m_queue_mutex;
|
std::mutex m_queue_mutex;
|
||||||
std::map<v3s16, BlockEmergeData> m_blocks_enqueued;
|
std::map<v3s16, BlockEmergeData> m_blocks_enqueued;
|
||||||
std::unordered_map<u16, u16> m_peer_queue_count;
|
std::unordered_map<u16, u16> m_peer_queue_count;
|
||||||
|
|
||||||
|
|
|
@ -34,10 +34,10 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
#include <queue>
|
#include <queue>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <atomic>
|
#include <atomic>
|
||||||
|
#include <mutex>
|
||||||
#include "irr_v3d.h"
|
#include "irr_v3d.h"
|
||||||
#include "activeobject.h"
|
#include "activeobject.h"
|
||||||
#include "util/numeric.h"
|
#include "util/numeric.h"
|
||||||
#include "threading/mutex.h"
|
|
||||||
#include "network/networkprotocol.h" // for AccessDeniedCode
|
#include "network/networkprotocol.h" // for AccessDeniedCode
|
||||||
|
|
||||||
class IGameDef;
|
class IGameDef;
|
||||||
|
@ -120,7 +120,7 @@ protected:
|
||||||
IGameDef *m_gamedef;
|
IGameDef *m_gamedef;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Mutex m_time_lock;
|
std::mutex m_time_lock;
|
||||||
|
|
||||||
DISABLE_CLASS_COPY(Environment);
|
DISABLE_CLASS_COPY(Environment);
|
||||||
};
|
};
|
||||||
|
|
|
@ -22,7 +22,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
|
||||||
|
|
||||||
std::unordered_map<u16, std::vector<v3s16>> FacePositionCache::cache;
|
std::unordered_map<u16, std::vector<v3s16>> FacePositionCache::cache;
|
||||||
Mutex FacePositionCache::cache_mutex;
|
std::mutex FacePositionCache::cache_mutex;
|
||||||
|
|
||||||
// Calculate the borders of a "d-radius" cube
|
// Calculate the borders of a "d-radius" cube
|
||||||
const std::vector<v3s16> &FacePositionCache::getFacePositions(u16 d)
|
const std::vector<v3s16> &FacePositionCache::getFacePositions(u16 d)
|
||||||
|
|
|
@ -21,11 +21,11 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
#define FACE_POSITION_CACHE_HEADER
|
#define FACE_POSITION_CACHE_HEADER
|
||||||
|
|
||||||
#include "irr_v3d.h"
|
#include "irr_v3d.h"
|
||||||
#include "threading/mutex.h"
|
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
|
#include <mutex>
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This class permits caching getFacePosition call results.
|
* This class permits caching getFacePosition call results.
|
||||||
|
@ -38,7 +38,7 @@ public:
|
||||||
private:
|
private:
|
||||||
static const std::vector<v3s16> &generateFacePosition(u16 d);
|
static const std::vector<v3s16> &generateFacePosition(u16 d);
|
||||||
static std::unordered_map<u16, std::vector<v3s16>> cache;
|
static std::unordered_map<u16, std::vector<v3s16>> cache;
|
||||||
static Mutex cache_mutex;
|
static std::mutex cache_mutex;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -25,6 +25,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
#include <list>
|
#include <list>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
#include <mutex>
|
||||||
#include "threading/event.h"
|
#include "threading/event.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "exceptions.h"
|
#include "exceptions.h"
|
||||||
|
@ -36,7 +37,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
#include "noise.h"
|
#include "noise.h"
|
||||||
|
|
||||||
Mutex g_httpfetch_mutex;
|
std::mutex g_httpfetch_mutex;
|
||||||
std::map<unsigned long, std::queue<HTTPFetchResult> > g_httpfetch_results;
|
std::map<unsigned long, std::queue<HTTPFetchResult> > g_httpfetch_results;
|
||||||
PcgRandom g_callerid_randomness;
|
PcgRandom g_callerid_randomness;
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
#include <queue>
|
#include <queue>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
#include <mutex>
|
||||||
#include "threads.h"
|
#include "threads.h"
|
||||||
#include "irrlichttypes.h"
|
#include "irrlichttypes.h"
|
||||||
|
|
||||||
|
@ -79,7 +80,7 @@ private:
|
||||||
// Works on all known architectures (x86, ARM, MIPS).
|
// Works on all known architectures (x86, ARM, MIPS).
|
||||||
volatile bool m_silenced_levels[LL_MAX];
|
volatile bool m_silenced_levels[LL_MAX];
|
||||||
std::map<threadid_t, std::string> m_thread_names;
|
std::map<threadid_t, std::string> m_thread_names;
|
||||||
mutable Mutex m_mutex;
|
mutable std::mutex m_mutex;
|
||||||
bool m_trace_enabled;
|
bool m_trace_enabled;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
#ifndef MESH_GENERATOR_THREAD_HEADER
|
#ifndef MESH_GENERATOR_THREAD_HEADER
|
||||||
#define MESH_GENERATOR_THREAD_HEADER
|
#define MESH_GENERATOR_THREAD_HEADER
|
||||||
|
|
||||||
|
#include <mutex>
|
||||||
#include "mapblock_mesh.h"
|
#include "mapblock_mesh.h"
|
||||||
#include "threading/mutex_auto_lock.h"
|
#include "threading/mutex_auto_lock.h"
|
||||||
#include "util/thread.h"
|
#include "util/thread.h"
|
||||||
|
@ -83,7 +84,7 @@ private:
|
||||||
std::vector<QueuedMeshUpdate *> m_queue;
|
std::vector<QueuedMeshUpdate *> m_queue;
|
||||||
std::set<v3s16> m_urgents;
|
std::set<v3s16> m_urgents;
|
||||||
std::map<v3s16, CachedMapBlockData *> m_cache;
|
std::map<v3s16, CachedMapBlockData *> m_cache;
|
||||||
Mutex m_mutex;
|
std::mutex m_mutex;
|
||||||
|
|
||||||
// TODO: Add callback to update these when g_settings changes
|
// TODO: Add callback to update these when g_settings changes
|
||||||
bool m_cache_enable_shaders;
|
bool m_cache_enable_shaders;
|
||||||
|
|
|
@ -23,7 +23,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
#include "irrlichttypes_extrabloated.h"
|
#include "irrlichttypes_extrabloated.h"
|
||||||
#include "client.h"
|
#include "client.h"
|
||||||
#include "voxel.h"
|
#include "voxel.h"
|
||||||
#include "threading/mutex.h"
|
|
||||||
#include "threading/semaphore.h"
|
#include "threading/semaphore.h"
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
@ -112,7 +111,7 @@ protected:
|
||||||
virtual void doUpdate();
|
virtual void doUpdate();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Mutex m_queue_mutex;
|
std::mutex m_queue_mutex;
|
||||||
std::deque<QueuedMinimapUpdate> m_update_queue;
|
std::deque<QueuedMinimapUpdate> m_update_queue;
|
||||||
std::map<v3s16, MinimapMapblock *> m_blocks_cache;
|
std::map<v3s16, MinimapMapblock *> m_blocks_cache;
|
||||||
};
|
};
|
||||||
|
@ -161,7 +160,7 @@ private:
|
||||||
bool m_enable_shaders;
|
bool m_enable_shaders;
|
||||||
u16 m_surface_mode_scan_height;
|
u16 m_surface_mode_scan_height;
|
||||||
f32 m_angle;
|
f32 m_angle;
|
||||||
Mutex m_mutex;
|
std::mutex m_mutex;
|
||||||
std::list<v2f> m_active_markers;
|
std::list<v2f> m_active_markers;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,7 @@ namespace con
|
||||||
#undef DEBUG_CONNECTION_KBPS
|
#undef DEBUG_CONNECTION_KBPS
|
||||||
#else
|
#else
|
||||||
/* this mutex is used to achieve log message consistency */
|
/* this mutex is used to achieve log message consistency */
|
||||||
Mutex log_message_mutex;
|
std::mutex log_message_mutex;
|
||||||
#define LOG(a) \
|
#define LOG(a) \
|
||||||
{ \
|
{ \
|
||||||
MutexAutoLock loglock(log_message_mutex); \
|
MutexAutoLock loglock(log_message_mutex); \
|
||||||
|
|
|
@ -349,7 +349,7 @@ private:
|
||||||
|
|
||||||
u16 m_oldest_non_answered_ack;
|
u16 m_oldest_non_answered_ack;
|
||||||
|
|
||||||
Mutex m_list_mutex;
|
std::mutex m_list_mutex;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -372,7 +372,7 @@ private:
|
||||||
// Key is seqnum
|
// Key is seqnum
|
||||||
std::map<u16, IncomingSplitPacket*> m_buf;
|
std::map<u16, IncomingSplitPacket*> m_buf;
|
||||||
|
|
||||||
Mutex m_map_mutex;
|
std::mutex m_map_mutex;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct OutgoingPacket
|
struct OutgoingPacket
|
||||||
|
@ -544,7 +544,7 @@ public:
|
||||||
|
|
||||||
void setWindowSize(unsigned int size) { window_size = size; };
|
void setWindowSize(unsigned int size) { window_size = size; };
|
||||||
private:
|
private:
|
||||||
Mutex m_internal_mutex;
|
std::mutex m_internal_mutex;
|
||||||
int window_size;
|
int window_size;
|
||||||
|
|
||||||
u16 next_incoming_seqnum;
|
u16 next_incoming_seqnum;
|
||||||
|
@ -738,7 +738,7 @@ class Peer {
|
||||||
bool IncUseCount();
|
bool IncUseCount();
|
||||||
void DecUseCount();
|
void DecUseCount();
|
||||||
|
|
||||||
Mutex m_exclusive_access_mutex;
|
std::mutex m_exclusive_access_mutex;
|
||||||
|
|
||||||
bool m_pending_deletion;
|
bool m_pending_deletion;
|
||||||
|
|
||||||
|
@ -1064,12 +1064,12 @@ private:
|
||||||
|
|
||||||
std::map<u16, Peer*> m_peers;
|
std::map<u16, Peer*> m_peers;
|
||||||
std::list<u16> m_peer_ids;
|
std::list<u16> m_peer_ids;
|
||||||
Mutex m_peers_mutex;
|
std::mutex m_peers_mutex;
|
||||||
|
|
||||||
ConnectionSendThread m_sendThread;
|
ConnectionSendThread m_sendThread;
|
||||||
ConnectionReceiveThread m_receiveThread;
|
ConnectionReceiveThread m_receiveThread;
|
||||||
|
|
||||||
Mutex m_info_mutex;
|
std::mutex m_info_mutex;
|
||||||
|
|
||||||
// Backwards compatibility
|
// Backwards compatibility
|
||||||
PeerHandler *m_bc_peerhandler;
|
PeerHandler *m_bc_peerhandler;
|
||||||
|
|
|
@ -213,8 +213,8 @@ private:
|
||||||
std::map<u32, ParticleSpawner*> m_particle_spawners;
|
std::map<u32, ParticleSpawner*> m_particle_spawners;
|
||||||
|
|
||||||
ClientEnvironment* m_env;
|
ClientEnvironment* m_env;
|
||||||
Mutex m_particle_list_lock;
|
std::mutex m_particle_list_lock;
|
||||||
Mutex m_spawner_list_lock;
|
std::mutex m_spawner_list_lock;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -22,8 +22,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
|
||||||
#include "irrlichttypes_bloated.h"
|
#include "irrlichttypes_bloated.h"
|
||||||
#include "inventory.h"
|
#include "inventory.h"
|
||||||
#include "threading/mutex.h"
|
|
||||||
#include <list>
|
#include <list>
|
||||||
|
#include <mutex>
|
||||||
|
|
||||||
#define PLAYERNAME_SIZE 20
|
#define PLAYERNAME_SIZE 20
|
||||||
|
|
||||||
|
@ -186,7 +186,7 @@ private:
|
||||||
// Protect some critical areas
|
// Protect some critical areas
|
||||||
// hud for example can be modified by EmergeThread
|
// hud for example can be modified by EmergeThread
|
||||||
// and ServerThread
|
// and ServerThread
|
||||||
Mutex m_mutex;
|
std::mutex m_mutex;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -24,7 +24,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
#include "threading/mutex.h"
|
|
||||||
#include "threading/mutex_auto_lock.h"
|
#include "threading/mutex_auto_lock.h"
|
||||||
#include "util/timetaker.h"
|
#include "util/timetaker.h"
|
||||||
#include "util/numeric.h" // paging()
|
#include "util/numeric.h" // paging()
|
||||||
|
@ -177,7 +176,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Mutex m_mutex;
|
std::mutex m_mutex;
|
||||||
std::map<std::string, float> m_data;
|
std::map<std::string, float> m_data;
|
||||||
std::map<std::string, int> m_avgcounts;
|
std::map<std::string, int> m_avgcounts;
|
||||||
std::map<std::string, float> m_graphvalues;
|
std::map<std::string, float> m_graphvalues;
|
||||||
|
|
|
@ -18,7 +18,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "quicktune.h"
|
#include "quicktune.h"
|
||||||
#include "threading/mutex.h"
|
|
||||||
#include "threading/mutex_auto_lock.h"
|
#include "threading/mutex_auto_lock.h"
|
||||||
#include "util/string.h"
|
#include "util/string.h"
|
||||||
|
|
||||||
|
@ -49,12 +48,12 @@ void QuicktuneValue::relativeAdd(float amount)
|
||||||
|
|
||||||
static std::map<std::string, QuicktuneValue> g_values;
|
static std::map<std::string, QuicktuneValue> g_values;
|
||||||
static std::vector<std::string> g_names;
|
static std::vector<std::string> g_names;
|
||||||
Mutex *g_mutex = NULL;
|
std::mutex *g_mutex = NULL;
|
||||||
|
|
||||||
static void makeMutex()
|
static void makeMutex()
|
||||||
{
|
{
|
||||||
if(!g_mutex){
|
if(!g_mutex){
|
||||||
g_mutex = new Mutex();
|
g_mutex = new std::mutex();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
#include "threading/thread.h"
|
#include "threading/thread.h"
|
||||||
#include "threading/mutex.h"
|
|
||||||
#include "threading/semaphore.h"
|
#include "threading/semaphore.h"
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
#include "lua.h"
|
#include "lua.h"
|
||||||
|
@ -147,13 +146,13 @@ private:
|
||||||
unsigned int jobIdCounter;
|
unsigned int jobIdCounter;
|
||||||
|
|
||||||
// Mutex to protect job queue
|
// Mutex to protect job queue
|
||||||
Mutex jobQueueMutex;
|
std::mutex jobQueueMutex;
|
||||||
|
|
||||||
// Job queue
|
// Job queue
|
||||||
std::deque<LuaJobInfo> jobQueue;
|
std::deque<LuaJobInfo> jobQueue;
|
||||||
|
|
||||||
// Mutex to protect result queue
|
// Mutex to protect result queue
|
||||||
Mutex resultQueueMutex;
|
std::mutex resultQueueMutex;
|
||||||
// Result queue
|
// Result queue
|
||||||
std::deque<LuaJobInfo> resultQueue;
|
std::deque<LuaJobInfo> resultQueue;
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,6 @@ extern "C" {
|
||||||
|
|
||||||
#include "irrlichttypes.h"
|
#include "irrlichttypes.h"
|
||||||
#include "threads.h"
|
#include "threads.h"
|
||||||
#include "threading/mutex.h"
|
|
||||||
#include "threading/mutex_auto_lock.h"
|
#include "threading/mutex_auto_lock.h"
|
||||||
#include "common/c_types.h"
|
#include "common/c_types.h"
|
||||||
#include "common/c_internal.h"
|
#include "common/c_internal.h"
|
||||||
|
@ -116,7 +115,7 @@ protected:
|
||||||
|
|
||||||
void objectrefGetOrCreate(lua_State *L, ServerActiveObject *cobj);
|
void objectrefGetOrCreate(lua_State *L, ServerActiveObject *cobj);
|
||||||
|
|
||||||
RecursiveMutex m_luastackmutex;
|
std::recursive_mutex m_luastackmutex;
|
||||||
std::string m_last_run_mod;
|
std::string m_last_run_mod;
|
||||||
bool m_secure;
|
bool m_secure;
|
||||||
#ifdef SCRIPTAPI_LOCK_DEBUG
|
#ifdef SCRIPTAPI_LOCK_DEBUG
|
||||||
|
|
|
@ -375,7 +375,7 @@ public:
|
||||||
Address m_bind_addr;
|
Address m_bind_addr;
|
||||||
|
|
||||||
// Environment mutex (envlock)
|
// Environment mutex (envlock)
|
||||||
Mutex m_env_mutex;
|
std::mutex m_env_mutex;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
@ -578,7 +578,7 @@ private:
|
||||||
// A buffer for time steps
|
// A buffer for time steps
|
||||||
// step() increments and AsyncRunStep() run by m_thread reads it.
|
// step() increments and AsyncRunStep() run by m_thread reads it.
|
||||||
float m_step_dtime;
|
float m_step_dtime;
|
||||||
Mutex m_step_dtime_mutex;
|
std::mutex m_step_dtime_mutex;
|
||||||
|
|
||||||
// current server step lag counter
|
// current server step lag counter
|
||||||
float m_lag;
|
float m_lag;
|
||||||
|
|
|
@ -22,10 +22,10 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
|
||||||
#include "irrlichttypes_bloated.h"
|
#include "irrlichttypes_bloated.h"
|
||||||
#include "util/string.h"
|
#include "util/string.h"
|
||||||
#include "threading/mutex.h"
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <list>
|
#include <list>
|
||||||
#include <set>
|
#include <set>
|
||||||
|
#include <mutex>
|
||||||
|
|
||||||
class Settings;
|
class Settings;
|
||||||
struct NoiseParams;
|
struct NoiseParams;
|
||||||
|
@ -232,10 +232,10 @@ private:
|
||||||
|
|
||||||
SettingsCallbackMap m_callbacks;
|
SettingsCallbackMap m_callbacks;
|
||||||
|
|
||||||
mutable Mutex m_callback_mutex;
|
mutable std::mutex m_callback_mutex;
|
||||||
|
|
||||||
// All methods that access m_settings/m_defaults directly should lock this.
|
// All methods that access m_settings/m_defaults directly should lock this.
|
||||||
mutable Mutex m_mutex;
|
mutable std::mutex m_mutex;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -320,7 +320,7 @@ private:
|
||||||
// The first position contains a dummy shader.
|
// The first position contains a dummy shader.
|
||||||
std::vector<ShaderInfo> m_shaderinfo_cache;
|
std::vector<ShaderInfo> m_shaderinfo_cache;
|
||||||
// The former container is behind this mutex
|
// The former container is behind this mutex
|
||||||
Mutex m_shaderinfo_cache_mutex;
|
std::mutex m_shaderinfo_cache_mutex;
|
||||||
|
|
||||||
// Queued shader fetches (to be processed by the main thread)
|
// Queued shader fetches (to be processed by the main thread)
|
||||||
RequestQueue<std::string, u32, u8, u8> m_get_shader_queue;
|
RequestQueue<std::string, u32, u8, u8> m_get_shader_queue;
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
set(JTHREAD_SRCS
|
set(JTHREAD_SRCS
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/event.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/event.cpp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/mutex.cpp
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/thread.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/thread.cpp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/semaphore.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/semaphore.cpp
|
||||||
PARENT_SCOPE)
|
PARENT_SCOPE)
|
||||||
|
|
|
@ -25,67 +25,19 @@ DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
#include "threading/event.h"
|
#include "threading/event.h"
|
||||||
|
|
||||||
Event::Event()
|
|
||||||
{
|
|
||||||
#ifndef USE_CPP11_MUTEX
|
|
||||||
# if USE_WIN_MUTEX
|
|
||||||
event = CreateEvent(NULL, false, false, NULL);
|
|
||||||
# else
|
|
||||||
pthread_cond_init(&cv, NULL);
|
|
||||||
pthread_mutex_init(&mutex, NULL);
|
|
||||||
notified = false;
|
|
||||||
# endif
|
|
||||||
#elif USE_CPP11_MUTEX
|
|
||||||
notified = false;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifndef USE_CPP11_MUTEX
|
|
||||||
Event::~Event()
|
|
||||||
{
|
|
||||||
#if USE_WIN_MUTEX
|
|
||||||
CloseHandle(event);
|
|
||||||
#else
|
|
||||||
pthread_cond_destroy(&cv);
|
|
||||||
pthread_mutex_destroy(&mutex);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
void Event::wait()
|
void Event::wait()
|
||||||
{
|
{
|
||||||
#if USE_CPP11_MUTEX
|
|
||||||
MutexAutoLock lock(mutex);
|
MutexAutoLock lock(mutex);
|
||||||
while (!notified) {
|
while (!notified) {
|
||||||
cv.wait(lock);
|
cv.wait(lock);
|
||||||
}
|
}
|
||||||
notified = false;
|
notified = false;
|
||||||
#elif USE_WIN_MUTEX
|
|
||||||
WaitForSingleObject(event, INFINITE);
|
|
||||||
#else
|
|
||||||
pthread_mutex_lock(&mutex);
|
|
||||||
while (!notified) {
|
|
||||||
pthread_cond_wait(&cv, &mutex);
|
|
||||||
}
|
|
||||||
notified = false;
|
|
||||||
pthread_mutex_unlock(&mutex);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Event::signal()
|
void Event::signal()
|
||||||
{
|
{
|
||||||
#if USE_CPP11_MUTEX
|
|
||||||
MutexAutoLock lock(mutex);
|
MutexAutoLock lock(mutex);
|
||||||
notified = true;
|
notified = true;
|
||||||
cv.notify_one();
|
cv.notify_one();
|
||||||
#elif USE_WIN_MUTEX
|
|
||||||
SetEvent(event);
|
|
||||||
#else
|
|
||||||
pthread_mutex_lock(&mutex);
|
|
||||||
notified = true;
|
|
||||||
pthread_cond_signal(&cv);
|
|
||||||
pthread_mutex_unlock(&mutex);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,11 +28,8 @@ DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
#include "threads.h"
|
#include "threads.h"
|
||||||
|
|
||||||
#if USE_CPP11_MUTEX
|
|
||||||
#include <condition_variable>
|
#include <condition_variable>
|
||||||
#include "threading/mutex.h"
|
|
||||||
#include "threading/mutex_auto_lock.h"
|
#include "threading/mutex_auto_lock.h"
|
||||||
#endif
|
|
||||||
|
|
||||||
/** A syncronization primitive that will wake up one waiting thread when signaled.
|
/** A syncronization primitive that will wake up one waiting thread when signaled.
|
||||||
* Calling @c signal() multiple times before a waiting thread has had a chance
|
* Calling @c signal() multiple times before a waiting thread has had a chance
|
||||||
|
@ -43,25 +40,13 @@ DEALINGS IN THE SOFTWARE.
|
||||||
class Event
|
class Event
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Event();
|
|
||||||
#ifndef USE_CPP11_MUTEX
|
|
||||||
~Event();
|
|
||||||
#endif
|
|
||||||
void wait();
|
void wait();
|
||||||
void signal();
|
void signal();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
#if USE_CPP11_MUTEX
|
|
||||||
std::condition_variable cv;
|
std::condition_variable cv;
|
||||||
Mutex mutex;
|
std::mutex mutex;
|
||||||
bool notified;
|
bool notified = false;
|
||||||
#elif USE_WIN_MUTEX
|
|
||||||
HANDLE event;
|
|
||||||
#else
|
|
||||||
pthread_cond_t cv;
|
|
||||||
pthread_mutex_t mutex;
|
|
||||||
bool notified;
|
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,116 +0,0 @@
|
||||||
/*
|
|
||||||
This file is a part of the JThread package, which contains some object-
|
|
||||||
oriented thread wrappers for different thread implementations.
|
|
||||||
|
|
||||||
Copyright (c) 2000-2006 Jori Liesenborgs (jori.liesenborgs@gmail.com)
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a
|
|
||||||
copy of this software and associated documentation files (the "Software"),
|
|
||||||
to deal in the Software without restriction, including without limitation
|
|
||||||
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
||||||
and/or sell copies of the Software, and to permit persons to whom the
|
|
||||||
Software is furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in
|
|
||||||
all copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
||||||
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
||||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
||||||
DEALINGS IN THE SOFTWARE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "threads.h"
|
|
||||||
|
|
||||||
#ifndef USE_CPP11_MUTEX
|
|
||||||
|
|
||||||
#include "threading/mutex.h"
|
|
||||||
|
|
||||||
#include <cassert>
|
|
||||||
|
|
||||||
#define UNUSED(expr) do { (void)(expr); } while (0)
|
|
||||||
|
|
||||||
Mutex::Mutex()
|
|
||||||
{
|
|
||||||
init_mutex(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Mutex::Mutex(bool recursive)
|
|
||||||
{
|
|
||||||
init_mutex(recursive);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Mutex::init_mutex(bool recursive)
|
|
||||||
{
|
|
||||||
#if USE_WIN_MUTEX
|
|
||||||
// Windows critical sections are recursive by default
|
|
||||||
UNUSED(recursive);
|
|
||||||
|
|
||||||
InitializeCriticalSection(&mutex);
|
|
||||||
#else
|
|
||||||
pthread_mutexattr_t attr;
|
|
||||||
pthread_mutexattr_init(&attr);
|
|
||||||
|
|
||||||
if (recursive)
|
|
||||||
pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
|
|
||||||
|
|
||||||
int ret = pthread_mutex_init(&mutex, &attr);
|
|
||||||
assert(!ret);
|
|
||||||
UNUSED(ret);
|
|
||||||
|
|
||||||
pthread_mutexattr_destroy(&attr);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
Mutex::~Mutex()
|
|
||||||
{
|
|
||||||
#if USE_WIN_MUTEX
|
|
||||||
DeleteCriticalSection(&mutex);
|
|
||||||
#else
|
|
||||||
int ret = pthread_mutex_destroy(&mutex);
|
|
||||||
assert(!ret);
|
|
||||||
UNUSED(ret);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
void Mutex::lock()
|
|
||||||
{
|
|
||||||
#if USE_WIN_MUTEX
|
|
||||||
EnterCriticalSection(&mutex);
|
|
||||||
#else
|
|
||||||
int ret = pthread_mutex_lock(&mutex);
|
|
||||||
assert(!ret);
|
|
||||||
UNUSED(ret);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Mutex::try_lock()
|
|
||||||
{
|
|
||||||
#if USE_WIN_MUTEX
|
|
||||||
return TryEnterCriticalSection(&mutex) != 0;
|
|
||||||
#else
|
|
||||||
return pthread_mutex_trylock(&mutex) == 0;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
void Mutex::unlock()
|
|
||||||
{
|
|
||||||
#if USE_WIN_MUTEX
|
|
||||||
LeaveCriticalSection(&mutex);
|
|
||||||
#else
|
|
||||||
int ret = pthread_mutex_unlock(&mutex);
|
|
||||||
assert(!ret);
|
|
||||||
UNUSED(ret);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
RecursiveMutex::RecursiveMutex()
|
|
||||||
: Mutex(true)
|
|
||||||
{}
|
|
||||||
|
|
||||||
#endif // C++11
|
|
||||||
|
|
|
@ -1,84 +0,0 @@
|
||||||
/*
|
|
||||||
This file is a part of the JThread package, which contains some object-
|
|
||||||
oriented thread wrappers for different thread implementations.
|
|
||||||
|
|
||||||
Copyright (c) 2000-2006 Jori Liesenborgs (jori.liesenborgs@gmail.com)
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a
|
|
||||||
copy of this software and associated documentation files (the "Software"),
|
|
||||||
to deal in the Software without restriction, including without limitation
|
|
||||||
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
||||||
and/or sell copies of the Software, and to permit persons to whom the
|
|
||||||
Software is furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in
|
|
||||||
all copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
||||||
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
||||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
||||||
DEALINGS IN THE SOFTWARE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef THREADING_MUTEX_H
|
|
||||||
#define THREADING_MUTEX_H
|
|
||||||
|
|
||||||
#include "threads.h"
|
|
||||||
|
|
||||||
#if USE_CPP11_MUTEX
|
|
||||||
#include <mutex>
|
|
||||||
using Mutex = std::mutex;
|
|
||||||
using RecursiveMutex = std::recursive_mutex;
|
|
||||||
#else
|
|
||||||
|
|
||||||
#if USE_WIN_MUTEX
|
|
||||||
#ifndef _WIN32_WINNT
|
|
||||||
#define _WIN32_WINNT 0x0501
|
|
||||||
#endif
|
|
||||||
#ifndef WIN32_LEAN_AND_MEAN
|
|
||||||
#define WIN32_LEAN_AND_MEAN
|
|
||||||
#endif
|
|
||||||
#include <windows.h>
|
|
||||||
#else
|
|
||||||
#include <pthread.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "util/basic_macros.h"
|
|
||||||
|
|
||||||
class Mutex
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
Mutex();
|
|
||||||
~Mutex();
|
|
||||||
void lock();
|
|
||||||
void unlock();
|
|
||||||
|
|
||||||
bool try_lock();
|
|
||||||
|
|
||||||
protected:
|
|
||||||
Mutex(bool recursive);
|
|
||||||
void init_mutex(bool recursive);
|
|
||||||
private:
|
|
||||||
#if USE_WIN_MUTEX
|
|
||||||
CRITICAL_SECTION mutex;
|
|
||||||
#else
|
|
||||||
pthread_mutex_t mutex;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
DISABLE_CLASS_COPY(Mutex);
|
|
||||||
};
|
|
||||||
|
|
||||||
class RecursiveMutex : public Mutex
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
RecursiveMutex();
|
|
||||||
|
|
||||||
DISABLE_CLASS_COPY(RecursiveMutex);
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // C++11
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -23,40 +23,8 @@ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
DEALINGS IN THE SOFTWARE.
|
DEALINGS IN THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef THREADING_MUTEX_AUTO_LOCK_H
|
#pragma once
|
||||||
#define THREADING_MUTEX_AUTO_LOCK_H
|
|
||||||
|
|
||||||
#include "threads.h"
|
|
||||||
|
|
||||||
#if USE_CPP11_MUTEX
|
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
using MutexAutoLock = std::unique_lock<std::mutex>;
|
using MutexAutoLock = std::unique_lock<std::mutex>;
|
||||||
using RecursiveMutexAutoLock = std::unique_lock<std::recursive_mutex>;
|
using RecursiveMutexAutoLock = std::unique_lock<std::recursive_mutex>;
|
||||||
#else
|
|
||||||
|
|
||||||
#include "threading/mutex.h"
|
|
||||||
|
|
||||||
|
|
||||||
class MutexAutoLock
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
MutexAutoLock(Mutex &m) : mutex(m) { mutex.lock(); }
|
|
||||||
~MutexAutoLock() { mutex.unlock(); }
|
|
||||||
|
|
||||||
private:
|
|
||||||
Mutex &mutex;
|
|
||||||
};
|
|
||||||
|
|
||||||
class RecursiveMutexAutoLock
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
RecursiveMutexAutoLock(RecursiveMutex &m) : mutex(m) { mutex.lock(); }
|
|
||||||
~RecursiveMutexAutoLock() { mutex.unlock(); }
|
|
||||||
|
|
||||||
private:
|
|
||||||
RecursiveMutex &mutex;
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
|
@ -27,11 +27,11 @@ DEALINGS IN THE SOFTWARE.
|
||||||
#define THREADING_THREAD_H
|
#define THREADING_THREAD_H
|
||||||
|
|
||||||
#include "util/basic_macros.h"
|
#include "util/basic_macros.h"
|
||||||
#include "threading/mutex.h"
|
|
||||||
#include "threads.h"
|
#include "threads.h"
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <atomic>
|
#include <atomic>
|
||||||
|
#include <mutex>
|
||||||
|
|
||||||
#ifdef _AIX
|
#ifdef _AIX
|
||||||
#include <sys/thread.h> // for tid_t
|
#include <sys/thread.h> // for tid_t
|
||||||
|
@ -153,8 +153,8 @@ private:
|
||||||
bool m_joinable;
|
bool m_joinable;
|
||||||
std::atomic<bool> m_request_stop;
|
std::atomic<bool> m_request_stop;
|
||||||
std::atomic<bool> m_running;
|
std::atomic<bool> m_running;
|
||||||
Mutex m_mutex;
|
std::mutex m_mutex;
|
||||||
Mutex m_start_finished_mutex;
|
std::mutex m_start_finished_mutex;
|
||||||
|
|
||||||
#if USE_CPP11_THREADS
|
#if USE_CPP11_THREADS
|
||||||
std::thread *m_thread_obj;
|
std::thread *m_thread_obj;
|
||||||
|
|
|
@ -54,8 +54,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "threading/mutex.h"
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// threadid_t, threadhandle_t
|
// threadid_t, threadhandle_t
|
||||||
//
|
//
|
||||||
|
|
|
@ -22,7 +22,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
|
||||||
#include "../irrlichttypes.h"
|
#include "../irrlichttypes.h"
|
||||||
#include "../exceptions.h"
|
#include "../exceptions.h"
|
||||||
#include "../threading/mutex.h"
|
|
||||||
#include "../threading/mutex_auto_lock.h"
|
#include "../threading/mutex_auto_lock.h"
|
||||||
#include "../threading/semaphore.h"
|
#include "../threading/semaphore.h"
|
||||||
#include <list>
|
#include <list>
|
||||||
|
@ -117,7 +116,7 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::map<Key, Value> m_values;
|
std::map<Key, Value> m_values;
|
||||||
mutable Mutex m_mutex;
|
mutable std::mutex m_mutex;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -225,12 +224,12 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
Mutex &getMutex() { return m_mutex; }
|
std::mutex &getMutex() { return m_mutex; }
|
||||||
|
|
||||||
std::deque<T> &getQueue() { return m_queue; }
|
std::deque<T> &getQueue() { return m_queue; }
|
||||||
|
|
||||||
std::deque<T> m_queue;
|
std::deque<T> m_queue;
|
||||||
mutable Mutex m_mutex;
|
mutable std::mutex m_mutex;
|
||||||
Semaphore m_signal;
|
Semaphore m_signal;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
#include "../irr_v2d.h"
|
#include "../irr_v2d.h"
|
||||||
#include "../irr_v3d.h"
|
#include "../irr_v3d.h"
|
||||||
#include "../irr_aabb3d.h"
|
#include "../irr_aabb3d.h"
|
||||||
#include "../threading/mutex.h"
|
|
||||||
|
|
||||||
#define rangelim(d, min, max) ((d) < (min) ? (min) : ((d) > (max) ? (max) : (d)))
|
#define rangelim(d, min, max) ((d) < (min) ? (min) : ((d) > (max) ? (max) : (d)))
|
||||||
#define myfloor(x) ((x) < 0.0 ? (int)(x) - 1 : (int)(x))
|
#define myfloor(x) ((x) < 0.0 ? (int)(x) - 1 : (int)(x))
|
||||||
|
|
|
@ -22,7 +22,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
|
||||||
#include "../irrlichttypes.h"
|
#include "../irrlichttypes.h"
|
||||||
#include "../threading/thread.h"
|
#include "../threading/thread.h"
|
||||||
#include "../threading/mutex.h"
|
|
||||||
#include "../threading/mutex_auto_lock.h"
|
#include "../threading/mutex_auto_lock.h"
|
||||||
#include "porting.h"
|
#include "porting.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
@ -51,7 +50,7 @@ public:
|
||||||
// You pretty surely want to grab the lock when accessing this
|
// You pretty surely want to grab the lock when accessing this
|
||||||
T m_value;
|
T m_value;
|
||||||
private:
|
private:
|
||||||
Mutex m_mutex;
|
std::mutex m_mutex;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in New Issue