Make reads and writes of the guard variable atomic.
authorEric Fiselier <eric@efcs.ca>
Mon, 8 Apr 2019 21:26:25 +0000 (21:26 +0000)
committerEric Fiselier <eric@efcs.ca>
Mon, 8 Apr 2019 21:26:25 +0000 (21:26 +0000)
commit62c2b5ac680d36d383bf44f392bb5f1c5864adb0
tree5f51e7472400da68fd1677e173a746fc425be815
parent773e04c88366b86a4285f296ab6d632597f07db8
Make reads and writes of the guard variable atomic.

The read of the guard variable by the caller is atomic,
and doesn't happen under a mutex.

Our internal reads and writes were non-atomic, because they happened
under a mutex.

The writes should always be atomic since they can be observed outside
of the lock.

Making the reads atomic is not strictly necessary under the current
global mutex approach, but will be under implementations that use a
futex (which I plan to land shortly). However, they should add little
additional cost.

llvm-svn: 357944
libcxxabi/src/cxa_guard.cpp