Shrink ART Mutex exclusive_owner_ field to Atomic<pid_t>
The old volatile uint64_t version had a data race, and was thus technically incorrect. Since it's unclear whether volatile uint64_t updates are actually atomic on 32-bit platforms, even the informal correctness argument here already effectively assumed that the upper 32 bits were zero. Don't store them. Explicitly complain if a pid_t might be too big to support lock-free atomic operations. Remove many explicit references to exclusive_owner to avoid littering the code with LoadRelaxed calls. The return convention for GetExclusiveOwnerTid() was unclear for the shared ownership case. It was previously treated inconsistently as 0 (pthread locks), (uint64_t)(-1U) and (uint64_t)(-1). Make it as consistent as easily possible, and document remaining weirdness. Bug: 65171052 Test: AOSP builds. Host tests pass. Change-Id: Ia99aca268952597a90b3c798b714cddbdc2c365e
Loading
Please sign in to comment