提交 d3a432a7 编写于 作者: E Ebrahim Byagowi 提交者: Behdad Esfahbod

[graphite] Make get_table threadsafe (#931)

上级 80395f14
...@@ -79,10 +79,12 @@ static const void *hb_graphite2_get_table (const void *data, unsigned int tag, s ...@@ -79,10 +79,12 @@ static const void *hb_graphite2_get_table (const void *data, unsigned int tag, s
p->blob = blob; p->blob = blob;
p->tag = tag; p->tag = tag;
/* TODO Not thread-safe, but fairly harmless. retry:
* We can do the double-checked pointer cmpexch thing here. */ hb_graphite2_tablelist_t *tlist = (hb_graphite2_tablelist_t *) hb_atomic_ptr_get (&face_data->tlist);
p->next = face_data->tlist; p->next = tlist;
face_data->tlist = p;
if (!hb_atomic_ptr_cmpexch (&face_data->tlist, tlist, p))
goto retry;
} }
unsigned int tlen; unsigned int tlen;
......
/* /*
* Copyright (C) 2011 Martin Hosken * Copyright © 2011 Martin Hosken
* Copyright (C) 2011 SIL International * Copyright © 2011 SIL International
* *
* This is part of HarfBuzz, a text shaping library. * This is part of HarfBuzz, a text shaping library.
* *
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册