You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
PR #243 added ManualResetEvent with a mutex-protected boolean state and WaitList. Its approval review left the internal representation as a follow-up exploration: the ideas may improve the implementation, but keeping the current design is valid if the alternatives do not preserve its contracts or reduce overall cost.
Questions to explore
Can ManualResetEvent replace WaitList and its per-waiter notified state with WaitSet while preserving the rule that every wait registered before set remains committed even if reset happens before its next poll?
Can is_set and the already-set wait path use an atomic boolean, or another compact atomic state, instead of acquiring the state mutex on every observation?
Requirements
preserve the public API and the set/reset, first-poll registration, cancellation, and memory-publication contracts introduced by feat(event): add a manual-reset event #243;
prevent lost wake-ups across concurrent state checks, waiter registration, set, and reset;
keep waker clone, drop, and wake callbacks outside internal locks;
account for reentrant callbacks and a rapid set followed by reset;
compare complexity and benchmark results with the current implementation, including is_set, already-set waits, pending registration/cancellation, set/reset reuse, and fan-out;
prefer the current implementation if an alternative only moves complexity or lacks a meaningful workload benefit.
Follow-up to #221 and #243. The originating approval review is here.
Background
PR #243 added
ManualResetEventwith a mutex-protected boolean state andWaitList. Its approval review left the internal representation as a follow-up exploration: the ideas may improve the implementation, but keeping the current design is valid if the alternatives do not preserve its contracts or reduce overall cost.Questions to explore
ManualResetEventreplaceWaitListand its per-waiternotifiedstate withWaitSetwhile preserving the rule that every wait registered beforesetremains committed even ifresethappens before its next poll?is_setand the already-set wait path use an atomic boolean, or another compact atomic state, instead of acquiring the state mutex on every observation?Requirements
set, andreset;setfollowed byreset;is_set, already-set waits, pending registration/cancellation, set/reset reuse, and fan-out;Follow-up to #221 and #243. The originating approval review is here.