Repository navigation
Simplify Futex.wake() by using stack instead of array - #263
Conversation
Replace the fixed-size array with a simple stack approach: - No array size limit (eliminates 64-waiter batching loop) - Build local stack using only next pointers - Wake all nodes from stack outside the lock The prev = null sentinel from remove() prevents concurrent remove() operations from manipulating nodes while they're in the local stack. Benefits: - Simpler code (single pass instead of batching loop) - No arbitrary limit on waiters per wake - Consistent pattern with Channel/BroadcastChannel All 328 tests pass.
📝 WalkthroughWalkthroughThe Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches🧪 Generate unit tests (beta)
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. Comment |
Summary
Simplifies
Futex.wake()by replacing the fixed-size array approach with a simple stack-based approach.Changes
Before:
After:
nextpointersHow it works
remove()setsprev = null(sentinel)nextpointerThe
prev = nullsentinel prevents concurrentremove()operations from manipulating nodes while they're being processed in the local stack.Benefits
Testing
All 328 tests pass, including 13 Futex-specific tests.