diff options
author | Ben Wagner <bungeman@chromium.org> | 2020-10-29 22:29:00 -0400 |
---|---|---|
committer | Akira TAGOH <akira@tagoh.org> | 2020-11-02 05:05:24 +0000 |
commit | 447b9ccc7d03bf953d1f1c4708ca16c56c1511ec (patch) | |
tree | 5b69e5e01c87bf3d25499c5adf3c4b1a1dde21c9 /src/fccfg.c | |
parent | 4ee43476917b4d203c919471662c7e740cf6205a (diff) |
Fix fc_atomic_ptr_get and use.
Before this change building with ThreadSanitizer and running
test/test-pthread generated a large number of threading issues. These
mostly stemmed from fc_atomic_ptr_get not doing an atomic load and using
"acquire load" instead of "load acquire". After making these changes it
was still necessary to use fc_atomic_ptr_get where it was needed.
This also documents the current memory barrier requirements for the
atomic primitives.
Diffstat (limited to 'src/fccfg.c')
-rw-r--r-- | src/fccfg.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/fccfg.c b/src/fccfg.c index 1c62cad..7b857bf 100644 --- a/src/fccfg.c +++ b/src/fccfg.c @@ -67,14 +67,15 @@ retry: static void unlock_config (void) { - FcMutexUnlock (_lock); + FcMutex *lock; + lock = fc_atomic_ptr_get (&_lock); + FcMutexUnlock (lock); } static void free_lock (void) { FcMutex *lock; - lock = fc_atomic_ptr_get (&_lock); if (lock && fc_atomic_ptr_cmpexch (&_lock, lock, NULL)) { |