mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-08 06:53:45 +00:00
ICU-20689 Fix race condition in UMutex code, leading to random crashes.
This commit is contained in:
parent
d56f291178
commit
2cd213ac3b
1 changed files with 2 additions and 1 deletions
|
@ -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…
Add table
Reference in a new issue