Anywhere queue could by implemented with reader/writer locks
The "anywhere queue" currently uses a mutex for enqueue and dequeue operations, which are fully locked using a std::mutex
. It would be possible to use a reader/writer lock (std::shared_mutex
in CPP): This would allow the dequeue operation to only take the reader lock first, and bail out if the queue is empty. We could even consider using boost's UpgradeLockable
, which is a upgradable reader/writer lock.