[graphite] Make get_table threadsafe (#931)

pull/943/head
Ebrahim Byagowi 7 years ago committed by Behdad Esfahbod
parent 80395f14e8
commit d3a432a7b2
  1. 10
      src/hb-graphite2.cc
  2. 4
      src/hb-graphite2.h

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

@ -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.
*

Loading…
Cancel
Save