Skip to content

Rename ConcurrentQueue to WaitQueue - #63

Merged
lalinsky merged 2 commits into
mainfrom
wait-queue
Oct 21, 2025
Merged

lalinsky merged 2 commits into
mainfrom
wait-queue

Conversation

@lalinsky

@lalinsky lalinsky commented Oct 21, 2025 •

Copy link
Copy Markdown
Owner

The name WaitQueue better reflects the primary purpose of this data structure: managing tasks/nodes waiting for synchronization events. While it's technically a concurrent queue, "waiting" is what it's fundamentally used for across all use cases:

  • Mutex: tasks waiting for the lock
  • ResetEvent: tasks waiting for the event to be set
  • Condition: tasks waiting for a condition
  • AnyTaskList: tasks waiting to be processed during shutdown

The dual sentinel states (for encoding binary state like locked/unlocked, set/unset, open/closed) are an implementation detail that makes the queue efficient, but the core purpose is wait queue management.

Changes:

  • Renamed src/utils/concurrent_queue.zig → src/utils/wait_queue.zig
  • Renamed ConcurrentQueue(T) → WaitQueue(T)
  • Updated CompactConcurrentQueue reference → CompactWaitQueue
  • Updated all imports and usages across 11 files
  • Updated test names and benchmark output
  • All tests passing

Summary by CodeRabbit

  • Refactor
    • Swapped the internal queue implementation used across synchronization primitives, runtime task lists, and benchmarks to a new wait-oriented queue, improving consistency of wait/notify mechanics.
    • Added a small user-data field to wait nodes to carry extra metadata for waiting operations; no public APIs or behaviors were intentionally changed.

The name WaitQueue better reflects the primary purpose of this data structure:
managing tasks/nodes waiting for synchronization events. While it's technically
a concurrent queue, "waiting" is what it's fundamentally used for across all
use cases:
- Mutex: tasks waiting for the lock
- ResetEvent: tasks waiting for the event to be set
- Condition: tasks waiting for a condition
- AnyTaskList: tasks waiting to be processed during shutdown

The dual sentinel states (for encoding binary state like locked/unlocked,
set/unset, open/closed) are an implementation detail that makes the queue
efficient, but the core purpose is wait queue management.

Changes:
- Renamed src/utils/concurrent_queue.zig → src/utils/wait_queue.zig
- Renamed ConcurrentQueue(T) → WaitQueue(T)
- Updated CompactConcurrentQueue reference → CompactWaitQueue
- Updated all imports and usages across 11 files
- Updated test names and benchmark output
- All tests passing
@coderabbitai

coderabbitai Bot commented Oct 21, 2025 •

Copy link
Copy Markdown
Contributor

Walkthrough

Replace ConcurrentQueue with WaitQueue across the codebase: update imports, type declarations, field signatures, and public exports in benchmarks, core, runtime, sync primitives, stack pool, and utils, plus rename the queue implementation file's public API.

Changes

Cohort / File(s) Summary
Benchmarks
benchmarks/concurrent_queue_bench.zig
Replace ConcurrentQueue with WaitQueue in instantiation, variable names, and printed output.
Core Awaitable
src/core/Awaitable.zig
Import WaitQueue instead of ConcurrentQueue; update waiting_list field type to WaitQueue(WaitNode).
Core WaitNode
src/core/WaitNode.zig
Update tail comment to reference CompactWaitQueue; add userdata: usize = undefined field.
Runtime Task Management
src/runtime.zig
Replace ConcurrentQueue import with WaitQueue; change TimeoutContext.wait_queue, AnyTaskList.queue, and AnyTaskList.State to use WaitQueue.
Stack Pool
src/stack_pool.zig
Import WaitQueue; change Bucket.queue from ConcurrentQueue(FreeListNode) to WaitQueue(FreeListNode).
Synchronization Primitives
src/sync/Condition.zig, src/sync/Mutex.zig, src/sync/ResetEvent.zig
Import WaitQueue instead of ConcurrentQueue; update wait_queue fields and State type aliases to WaitQueue(...) and adjust TimeoutContext pointer types.
Utils Module
src/utils.zig
Remove pub const ConcurrentQueue = ...; add pub const WaitQueue = wait_queue.WaitQueue;.
Queue Implementation
src/utils/wait_queue.zig
Rename public API from pub fn ConcurrentQueue(comptime T: type) type to pub fn WaitQueue(comptime T: type) and update internal references.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

Poem

🐰 I hopped through code, a gentle cue,
Swapped names from old to bright and new,
WaitQueue now where Concurrent lay,
Fields renamed in tidy array,
A little refactor — cheerful stew! 🥕

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The pull request title "Rename ConcurrentQueue to WaitQueue" directly and clearly summarizes the primary change of this changeset. The entire PR consists of systematically renaming the ConcurrentQueue data structure to WaitQueue across 11 files, including the core type definition in src/utils/wait_queue.zig, all importing modules, benchmarks, and tests. The title is concise, specific, and accurately reflects what a developer would observe in the changeset without being vague or misleading.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch wait-queue

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between faa3894 and 2db4652.

📒 Files selected for processing (1)
  • src/core/WaitNode.zig (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/core/WaitNode.zig

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Base automatically changed from work-stealing-queue to main October 21, 2025 10:08
@lalinsky

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Oct 21, 2025

Copy link
Copy Markdown
Contributor
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

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.

1 participant