don't allow zone to shutdown while spawn process takes place, check by using MMasterSpawnLock first

This commit is contained in:
Emagi 2025-08-17 18:18:29 -04:00
parent 2858455d9d
commit 05f5061c19

View File

@ -191,11 +191,15 @@ ZoneServer::ZoneServer(const char* name) {
typedef map <int32, bool> ChangedSpawnMapType; typedef map <int32, bool> ChangedSpawnMapType;
ZoneServer::~ZoneServer() { ZoneServer::~ZoneServer() {
lua_interface->DeletePendingSpells(true, this); lua_interface->DeletePendingSpells(true, this);
MMasterSpawnLock.writelock(__FUNCTION__, __LINE__);
zoneShuttingDown = true; //ensure other threads shut down too zoneShuttingDown = true; //ensure other threads shut down too
//allow other threads to properly shut down //allow other threads to properly shut down
if(is_initialized) { if(is_initialized) {
LogWrite(ZONE__INFO, 0, "Zone", "Initiating zone shutdown of '%s'", zone_name); LogWrite(ZONE__INFO, 0, "Zone", "Initiating zone shutdown of '%s'", zone_name);
} }
MMasterSpawnLock.releasewritelock(__FUNCTION__, __LINE__);
int32 disp_count = 0; int32 disp_count = 0;
int32 next_disp_count = 100; int32 next_disp_count = 100;
while (spawnthread_active || initial_spawn_threads_active > 0){ while (spawnthread_active || initial_spawn_threads_active > 0){