Bug 90305 - Use C++11 atomic intrinsics
Summary: Use C++11 atomic intrinsics
Status: RESOLVED MOVED
Alias: None
Product: HarfBuzz
Classification: Unclassified
Component: src (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: Behdad Esfahbod
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-05-04 18:13 UTC by Behdad Esfahbod
Modified: 2017-06-25 04:33 UTC (History)
2 users (show)

See Also:
i915 platform:
i915 features:


Attachments
harfbuzz-atomics.patch (2.75 KB, patch)
2015-05-06 18:47 UTC, Nathan Froyd
Details | Splinter Review

Description Behdad Esfahbod 2015-05-04 18:13:55 UTC
See discussion at https://bugs.freedesktop.org/show_bug.cgi?id=90303

(We should also try ThreadSanitizer on HarfBuzz some time.)
Comment 1 Nathan Froyd 2015-05-06 18:47:21 UTC
Created attachment 115603 [details] [review]
harfbuzz-atomics.patch

Here's something that seems to work for me
Comment 2 Behdad Esfahbod 2015-05-06 20:11:05 UTC
Thanks.  Are these able to replace pthreads mutex implementation as well?
Comment 3 Nathan Froyd 2015-05-06 20:23:15 UTC
I'm assuming you mean the bits in hb-mutex-private.hh?  I suppose we could write something for HAVE_CXX11_ATOMIC_PRIMITIVES, but I'm not sure it makes a big difference: such a case is only hit on a non-Windows system with threads (but not pthreads) and a GCC-esque compiler...seems like kind of an unusual system.

The argument for making the hb-atomic-private.hh changes was to fix hb_atomic_ptr_impl_get so that the atomicity of the load was visible to TSan or similar.  There's not an equivalent case here; the interesting accesses are both fully covered by the __sync_* operations.
Comment 4 Behdad Esfahbod 2015-05-06 20:27:57 UTC
Makes sense.  Thanks.

FWIW, I always wondered about the cryptic way the atomic get/set were implemented.
Comment 5 Behdad Esfahbod 2017-06-25 04:33:02 UTC
Following up here: https://github.com/behdad/harfbuzz/issues/345


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.