Fix RWMutex to be thread-safe when pthread_rwlock is not available
authorMark Seaborn <mseaborn@chromium.org>
Sat, 1 Mar 2014 04:30:32 +0000 (04:30 +0000)
committerMark Seaborn <mseaborn@chromium.org>
Sat, 1 Mar 2014 04:30:32 +0000 (04:30 +0000)
commit79ac85be0b3a519724a56b3dc69375fed4202b4f
treec180ff2f15593da505c55e904ab54545012c0451
parentf38b536b3d49b376c40155ae729e33ecc3069b47
Fix RWMutex to be thread-safe when pthread_rwlock is not available

lib/Support/RWMutex.cpp contains an implementation of RWMutex that
uses pthread_rwlock, but when pthread_rwlock is not available (such as
under NaCl, when using newlib), it silently falls back to using the
no-op definition in lib/Support/Unix/RWMutex.inc, which is not
thread-safe.

Fix this case to be thread-safe by using a normal mutex.

Differential Revision: http://llvm-reviews.chandlerc.com/D2892

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202570 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Support/Unix/RWMutex.inc