[cache] Use atomic writes in clear()

To help TSan.
This commit is contained in:
Behdad Esfahbod 2018-09-27 16:54:23 -04:00
parent 9e9a36ee65
commit 305468708d
1 changed files with 4 additions and 1 deletions

View File

@ -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
{