Skip to content

fix: remove pr_empty flag in ex_cpu queue which was causing lost wakeups#175

Merged
tzcnt merged 1 commit intomainfrom
remove_pr_empty
Jan 19, 2026
Merged

fix: remove pr_empty flag in ex_cpu queue which was causing lost wakeups#175
tzcnt merged 1 commit intomainfrom
remove_pr_empty

Conversation

@tzcnt
Copy link
Copy Markdown
Owner

@tzcnt tzcnt commented Jan 19, 2026

[backported to v1.3]

pr_empty was added in v1.3 as an optimization for the case where a thread is only pulling data from another thread and not spawning any tasks in its own queue. However, this could lead to lost wakeups in lightly loaded scenarios if this thread raced with another thread and both threads failed to dequeue the item (which can happen during normal operation of the queue); it would then mark its own queue as "empty" and then not check it again.

Reverting the pr_empty flag is the simplest solution for now, as I'm planning to switch to a more efficient Chase-Lev queue in the future.

@tzcnt tzcnt merged commit 279f51c into main Jan 19, 2026
40 checks passed
@tzcnt tzcnt deleted the remove_pr_empty branch January 19, 2026 22:23
tzcnt added a commit that referenced this pull request Jan 20, 2026
@solbjorn
Copy link
Copy Markdown
Contributor

I'm planning to switch to a more efficient Chase-Lev queue in the future.

Just out of curiosity: how soon? Will it be wsq from TaskFlow or something new from scratch?

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.

2 participants