diff options
author | Akira Kakuto <kakuto@fuk.kindai.ac.jp> | 2018-08-09 09:18:27 +0000 |
---|---|---|
committer | Akira Kakuto <kakuto@fuk.kindai.ac.jp> | 2018-08-09 09:18:27 +0000 |
commit | 9139d285da34f265af4e9839a69f90fe04e5e764 (patch) | |
tree | 16a316d1c6b52b8f2e1085e1929b128bed3f9758 /Build/source/libs/harfbuzz/harfbuzz-src/src | |
parent | b19dad77c90e61d5cc70dc0d358bd185846a2756 (diff) |
harfbuzz 1.8.7
git-svn-id: svn://tug.org/texlive/trunk@48381 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/libs/harfbuzz/harfbuzz-src/src')
-rw-r--r-- | Build/source/libs/harfbuzz/harfbuzz-src/src/hb-machinery-private.hh | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-machinery-private.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-machinery-private.hh index 119625c45a2..ec41e2bcf69 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-machinery-private.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-machinery-private.hh @@ -639,8 +639,16 @@ struct hb_lazy_loader_t inline void set_stored (Stored *instance_) { - assert (instance == nullptr); - instance = instance_; + /* This *must* be called when there are no other threads accessing. + * However, to make TSan, etc, happy, we using cmpexch. */ + retry: + Stored *p = (Stored *) hb_atomic_ptr_get (&this->instance); + if (p) + { + if (unlikely (!hb_atomic_ptr_cmpexch (const_cast<Stored **>(&this->instance), p, instance_))) + goto retry; + thiz ()->destroy (p); + } } inline const Returned * get (void) const |