Repository navigation
Add FiberCondVar - #51
Merged
Merged
Conversation
vadimskipin
force-pushed
the
vskipin/condvar
branch
from
May 27, 2026 09:28
8d93f40 to
26c7489
Compare
When handleExpiredWaitersSlow ran its tree.remove() before clearing IN_TABLE, a concurrent cancelSleep could observe state with IN_TABLE still set, push to cancelQueue, then handleCancelQueueSlow on the next iteration would call tree.remove() again on the already-removed node -- corrupting the rbtree and SEGV'ing on the next iterator walk.
The relaxed-spin + acquire-fence pattern is correct under the C++ memory model but TSan does not track HB through standalone acquire fences. Under TSan, replace the fence with an acquire-load on the counter so the release-acquire pair on this atomic is directly visible to the tool; the prior TSAN_RELEASE/TSAN_ACQUIRE side-channel annotations on waitState become unnecessary. Production keeps the fence -- no extra atomic op on weak archs.
Implements a fiber-aware condition variable with notify_one/notify_all semantics. wait() atomically releases the protecting lock and suspends, re-acquiring before return; wait_for() adds a nanosecond-bounded variant.
vadimskipin
force-pushed
the
vskipin/condvar
branch
from
May 27, 2026 16:30
26c7489 to
a589853
Compare
vadimskipin
marked this pull request as ready for review
May 27, 2026 16:30
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements a fiber-aware condition variable with notify_one/notify_all semantics. wait() atomically releases the protecting lock and suspends, re-acquiring before return; wait_for() adds a nanosecond-bounded variant.