found another deadlock location, AddTimer is now restricted to 10ms or higher

This commit is contained in:
Image 2021-04-18 06:52:22 -04:00
parent 1f62d0eb44
commit 52d38ca175
3 changed files with 6 additions and 3 deletions

View file

@ -3396,6 +3396,9 @@ int EQ2Emu_lua_AddTimer(lua_State* state) {
Spawn* player = lua_interface->GetSpawn(state, 5);
SpawnScriptTimer* timer = new SpawnScriptTimer;
if ( time < 10)
time = 10;
timer->timer = Timer::GetCurrentTime2() + time;
timer->function = function;
timer->spawn = spawn->GetID();

View file

@ -778,10 +778,9 @@ void MobMovementManager::DisruptNavigation(Entity* who)
if (!who->IsRunning()) {
who->MCommandMutex.writelock();
ent.second.Commands.clear();
MobListMutex.releasereadlock();
who->MCommandMutex.releasewritelock();
return;
}
MobListMutex.releasereadlock();
}
/**

View file

@ -3778,7 +3778,8 @@ void ZoneServer::CheckSpawnScriptTimers(){
set<SpawnScriptTimer*>::iterator itr;
for (itr = spawn_script_timers.begin(); itr != spawn_script_timers.end(); itr++) {
timer = *itr;
if(timer->current_count < timer->max_count && current_time >= timer->timer){
if(remove_spawn_script_timers_list.count(timer) == 0 &&
timer->current_count < timer->max_count && current_time >= timer->timer){
timer->current_count++;
call_timers.push_back(timer);
}