323ff2021fb7798b26be91445891b2c429f53543
PROBLEM: QuestCompletion used std::mutex for read-heavy data structures which blocked ALL readers when ANY read was happening. With 100+ bots calling quest-related functions from ThreadPool workers, this caused severe lock contention and task delays. AFFECTED MUTEXES (all read-heavy patterns): - _pausedBotsMutex: Checked on EVERY quest event (HandleQuestEvent) - _questOrderMutex: Read frequently during quest prioritization - _objectiveOrderMutex: Read during objective sequencing SOLUTION: 1. Changed _pausedBotsMutex from std::mutex to std::shared_mutex - Read operations (find) use std::shared_lock (concurrent readers OK) - Write operations (insert/erase) use std::unique_lock (exclusive) 2. Changed _questOrderMutex from std::mutex to std::shared_mutex - All operations use std::unique_lock (mostly writes in current code) - Future optimization: use shared_lock for read-only accesses 3. Changed _objectiveOrderMutex from std::mutex to std::shared_mutex - All operations use std::unique_lock (writes only currently) This eliminates a major ThreadPool bottleneck where every bot's quest event processing was blocking on mutex acquisition. Co-Authored-By: Claude Opus 4.5 <[email protected]> Signed-off-by: luis <[email protected]>
WowCommunityProject
Blizzlike WowCommunity project
Languages
C++
89.3%
C
10.1%
CMake
0.4%