[graphite] Make get_table threadsafe (#931)

This commit is contained in:
Ebrahim Byagowi 2018-03-30 04:58:47 +04:30 committed by Behdad Esfahbod
parent 80395f14e8
commit d3a432a7b2
2 changed files with 8 additions and 6 deletions

View File

@ -79,10 +79,12 @@ static const void *hb_graphite2_get_table (const void *data, unsigned int tag, s
p->blob = blob;
p->tag = tag;
/* TODO Not thread-safe, but fairly harmless.
* We can do the double-checked pointer cmpexch thing here. */
p->next = face_data->tlist;
face_data->tlist = p;
retry:
hb_graphite2_tablelist_t *tlist = (hb_graphite2_tablelist_t *) hb_atomic_ptr_get (&face_data->tlist);
p->next = tlist;
if (!hb_atomic_ptr_cmpexch (&face_data->tlist, tlist, p))
goto retry;
}
unsigned int tlen;

View File

@ -1,6 +1,6 @@
/*
* Copyright (C) 2011 Martin Hosken
* Copyright (C) 2011 SIL International
* Copyright © 2011 Martin Hosken
* Copyright © 2011 SIL International
*
* This is part of HarfBuzz, a text shaping library.
*