From 305468708dc9ce9dadad36c117c380f13bcc6a26 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Thu, 27 Sep 2018 16:54:23 -0400 Subject: [PATCH] [cache] Use atomic writes in clear() To help TSan. --- src/hb-cache.hh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/hb-cache.hh b/src/hb-cache.hh index f8581b4de..ec2e8635f 100644 --- a/src/hb-cache.hh +++ b/src/hb-cache.hh @@ -42,7 +42,10 @@ struct hb_cache_t inline void fini (void) {} inline void clear (void) - { memset (values, 255, sizeof (values)); } + { + for (unsigned i = 0; i < ARRAY_LENGTH (values); i++) + values[i].set_relaxed (-1); + } inline bool get (unsigned int key, unsigned int *value) const {