From the 0.2.1 review. Alternative to meta + gen + slots/: refs/locks/sem/<name>/state pointing at one immutable record holding the capacity and the complete slot set. Read one object, compute the next state, CAS one ref. The state used to count capacity is then exactly the state whose replacement is conditional, with no coherence to establish between separately observed refs. Cost: a larger object rewritten per operation and full serialisation within one semaphore. Benchmark against the current design before choosing; the smallest authority domain that makes the invariant straightforward wins, not the fewest refs.
From the 0.2.1 review. Alternative to meta + gen + slots/:
refs/locks/sem/<name>/statepointing at one immutable record holding the capacity and the complete slot set. Read one object, compute the next state, CAS one ref. The state used to count capacity is then exactly the state whose replacement is conditional, with no coherence to establish between separately observed refs. Cost: a larger object rewritten per operation and full serialisation within one semaphore. Benchmark against the current design before choosing; the smallest authority domain that makes the invariant straightforward wins, not the fewest refs.