Add wasm_module_obtain() to clone wasm_module_t (#1660)

Also add support for wasm_shared_module_t, and add lock for
wasm_module_t related operations.

And add wasm-c-api sample threads, update sample clone.
This commit is contained in:
liang.he
2022-11-09 12:50:58 +08:00
committed by GitHub
parent f59ffa0d63
commit 30ee992762
7 changed files with 425 additions and 97 deletions

View File

@ -464,6 +464,7 @@ struct WASMModuleCommon;
typedef struct WASMModuleCommon *wasm_module_t;
#endif
WASM_API_EXTERN own wasm_module_t* wasm_module_new(
wasm_store_t*, const wasm_byte_vec_t* binary);
@ -477,6 +478,11 @@ WASM_API_EXTERN void wasm_module_exports(const wasm_module_t*, own wasm_exportty
WASM_API_EXTERN void wasm_module_serialize(wasm_module_t*, own wasm_byte_vec_t* out);
WASM_API_EXTERN own wasm_module_t* wasm_module_deserialize(wasm_store_t*, const wasm_byte_vec_t*);
typedef wasm_module_t wasm_shared_module_t;
WASM_API_EXTERN own wasm_shared_module_t* wasm_module_share(wasm_module_t*);
WASM_API_EXTERN own wasm_module_t* wasm_module_obtain(wasm_store_t*, wasm_shared_module_t*);
WASM_API_EXTERN void wasm_shared_module_delete(own wasm_shared_module_t*);
// Function Instances