Enable lock for Vector to protect wasm-c-api read/write/extend operations (#1010)

This commit is contained in:
liang.he
2022-03-23 11:42:57 +08:00
committed by GitHub
parent e7079eeb17
commit 86b79cfb93
8 changed files with 198 additions and 121 deletions

View File

@ -88,6 +88,7 @@ typedef double float64_t;
wasm_##name##_t ptr_or_none* data; \
size_t num_elems; \
size_t size_of_elem; \
void *lock; \
} wasm_##name##_vec_t; \
\
WASM_API_EXTERN void wasm_##name##_vec_new_empty(own wasm_##name##_vec_t* out); \
@ -589,8 +590,8 @@ WASM_API_EXTERN void wasm_instance_exports(const wasm_instance_t*, own wasm_exte
// Vectors
#define WASM_EMPTY_VEC {0, NULL, 0, 0}
#define WASM_ARRAY_VEC(array) {sizeof(array)/sizeof(*(array)), array, sizeof(array)/sizeof(*(array)), sizeof(*(array))}
#define WASM_EMPTY_VEC {0, NULL, 0, 0, NULL}
#define WASM_ARRAY_VEC(array) {sizeof(array)/sizeof(*(array)), array, sizeof(array)/sizeof(*(array)), sizeof(*(array)), NULL}
// Value Type construction short-hands