Skip to content

datastructure: let ConcurrentQueue::pop() wait with a single lock - #1834

Merged
TheJJ merged 1 commit into
SFTtech:masterfrom
JotaJazz:datastructure-concurrent-queue-pop
Nov 14, 2026
Merged

TheJJ merged 1 commit into
SFTtech:masterfrom
JotaJazz:datastructure-concurrent-queue-pop

Conversation

@JotaJazz

Copy link
Copy Markdown
Contributor

pop() locked the recursive mutex and then waited in front(), which locked it a second time. The wait only releases one lock level, so the mutex stayed held, push() could never add an element and pop() on an empty queue deadlocked. pop() now waits itself, holding only one lock.

Fixes #1826

pop() locked the recursive mutex and then waited in front(), which
locked it a second time. The wait only releases one lock level, so the
mutex stayed held, push() could never add an element and pop() on an
empty queue deadlocked. pop() now waits itself, holding only one lock.

Fixes SFTtech#1826

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@TheJJ
TheJJ merged commit 5f042b9 into SFTtech:master Nov 14, 2026
13 of 14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Deadlock and Undefined Behavior in ConcurrentQueue::pop() on Empty Queue

2 participants