ICU-20689 Fix race condition in UMutex code, leading to random crashes.
This commit is contained in:
parent
d56f291178
commit
2cd213ac3b
@ -90,7 +90,8 @@ std::mutex *UMutex::getMutex() {
|
||||
if (retPtr == nullptr) {
|
||||
std::call_once(*pInitFlag, umtx_init);
|
||||
std::lock_guard<std::mutex> guard(*initMutex);
|
||||
if (fMutex.load() == nullptr) {
|
||||
retPtr = fMutex.load(std::memory_order_acquire);
|
||||
if (retPtr == nullptr) {
|
||||
fMutex = new(fStorage) std::mutex();
|
||||
retPtr = fMutex;
|
||||
fListLink = gListHead;
|
||||
|
Loading…
Reference in New Issue
Block a user