Re:Seqlock-Based Atomic Memory Snapshots
by slashdev on Saturday August 26, 2023 @07:51PM
(#37277986)
You can’t do that without a mutex. This provides a way to read a consistent snapshot of multiple atomic values without a mutex.
Obviously you could just use a mutex. This may perform better under some workloads, especially if writes are very rare.
>> you want the readers to be able to read multiple values atomically. I read this in TFA, and interpreted it to mean you could read multiple values atomically, which would be an answer to your question - mutexes only protect one thing and you can't combine them atomically.
But looking at the code, it seems that this does no better? It only allows reading of multiple values insofar as it protects one hard-coded struct which happens to have multiple fields.