[wasm-shape] Comment re thread-safety

This commit is contained in:
Behdad Esfahbod 2023-02-26 14:01:56 -07:00
parent 5235ee68ad
commit 7e5064ac1b
1 changed files with 10 additions and 3 deletions

View File

@ -114,7 +114,14 @@ struct hb_wasm_face_data_t {
static bool static bool
_hb_wasm_init () _hb_wasm_init ()
{ {
/* XXX Umm. Make this threadsafe. How?! */ /* XXX
*
* Umm. Make this threadsafe. How?!
* It's clunky that we can't allocate a static mutex.
* So we have to first allocate one on the heap atomically...
*
* Also, wasm-micro-runtime uses a singleton instance. So if
* another library or client uses it, all bets are off. :-( */
static bool initialized; static bool initialized;
if (initialized) if (initialized)
@ -140,8 +147,8 @@ _hb_wasm_init ()
} }
#ifndef HB_WASM_NO_MODULES #ifndef HB_WASM_NO_MODULES
wasm_runtime_set_module_reader(_hb_wasm_module_reader, wasm_runtime_set_module_reader (_hb_wasm_module_reader,
_hb_wasm_module_destroyer); _hb_wasm_module_destroyer);
#endif #endif
initialized = true; initialized = true;