On Wed Aug 23 22:27:38 2023 +0000, Yuxuan Shui wrote:
but on windows acquiring the lock does not block on this list locked bit. either they also have this ABA problem, or they have some magical secret sauce... :thinking:
what if we let `srwlock_transfer_ownership` go beyond the tail of the list when updating the head pointer? (there is at most one node beyond the tail.)
and we cmpxchg when updating the head pointer on `srwlock_wait`'s side, if that fails then we know it's up-to-date.
it's still possible for `transfer_ownership` to start and finish in between `we successfully written to the head pointer` ~ `we update lock ptr`, but in that case `transfer_ownership` would overwrite the head pointer with the updated one.