Anyone tried hooking up an eventcount to a seqlock, to handle blocking for multiple writers? Seems obvious now that I thought of it but haven’t implemented yet.
Or if writer fairness is a problem since signaled writers would just race on the CAS, maybe hook up a ticket lock instead?
@tobinbaker i don't see the event count for *writers*. for mutual exclusion, I'd expect a CAS spinlock (into futex), or maybe a ticket lock (coupled with the sequence).
@pkhuong yeah either futex or ticket lock (with blocking sleeps) could ensure fairness
@pkhuong the “CAS spinlock” is just trying to CAS-increment the counter, right? (using CAS to detect failure)
@pkhuong @tobinbaker wait can you use the sequence number as half of the ticket lock? cute
@moonchild @pkhuong it is cute but I think it would be more useful to use the counter as a futex word. blocking ticket locks make more sense than blocking spinlocks (because they give you an iteratively refined wait time estimate for free instead of blind exp. backoff or w/e), but I think precise waiting is better.