mirror of
https://github.com/zoriya/nitro.git
synced 2026-10-13 00:05:23 +00:00
_tasks is a std::queue (backed by std::deque), not thread-safe. Reading empty() outside the lock while worker threads call pop() and run() itself calls push() is an unsynchronized access — a data race caught by TSan. Move the check inside the existing lock scope and call addThread() after releasing (since addThread() also takes _queueMutex). Co-authored-by: Miklós Fazekas <boga@MBPM5P.local> Co-authored-by: Marc Rousavy <me@mrousavy.com>