Access linear memory size atomically (#2834)
Fixes: https://github.com/bytecodealliance/wasm-micro-runtime/issues/2804
This commit is contained in:
@ -14,6 +14,16 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if WASM_ENABLE_SHARED_MEMORY != 0
|
||||
#define GET_LINEAR_MEMORY_SIZE(memory) \
|
||||
BH_ATOMIC_32_LOAD(memory->memory_data_size)
|
||||
#define SET_LINEAR_MEMORY_SIZE(memory, size) \
|
||||
BH_ATOMIC_32_STORE(memory->memory_data_size, size)
|
||||
#else
|
||||
#define GET_LINEAR_MEMORY_SIZE(memory) memory->memory_data_size
|
||||
#define SET_LINEAR_MEMORY_SIZE(memory, size) memory->memory_data_size = size
|
||||
#endif
|
||||
|
||||
bool
|
||||
wasm_runtime_memory_init(mem_alloc_type_t mem_alloc_type,
|
||||
const MemAllocOption *alloc_option);
|
||||
|
||||
Reference in New Issue
Block a user