1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-08-06 17:41:04 +00:00

Divorce map database locking from env lock (#15151)

This commit is contained in:
sfan5 2024-09-11 19:17:08 +02:00
parent 526a2f7b8c
commit 588a0f83e9
6 changed files with 197 additions and 90 deletions

View file

@ -46,6 +46,7 @@ class DecorationManager;
class SchematicManager;
class Server;
class ModApiMapgen;
struct MapDatabaseAccessor;
// Structure containing inputs/outputs for chunk generation
struct BlockMakeData {
@ -173,6 +174,10 @@ public:
SchematicManager *getWritableSchematicManager();
void initMapgens(MapgenParams *mgparams);
/// @param holder non-owned reference that must stay alive
void initMap(MapDatabaseAccessor *holder);
/// resets the reference
void resetMap();
void startThreads();
void stopThreads();
@ -206,6 +211,9 @@ private:
std::vector<EmergeThread *> m_threads;
bool m_threads_active = false;
// The map database
MapDatabaseAccessor *m_db = nullptr;
std::mutex m_queue_mutex;
std::map<v3s16, BlockEmergeData> m_blocks_enqueued;
std::unordered_map<u16, u32> m_peer_queue_count;