From 74824ba790407d043ea34feefb9d530f4c5d26b6 Mon Sep 17 00:00:00 2001 From: Enrico Loparco Date: Wed, 15 Feb 2023 23:33:34 +0100 Subject: [PATCH] fix: update test to use atomic store (#32) --- test/testsuite/thread_spawn-simple.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/test/testsuite/thread_spawn-simple.c b/test/testsuite/thread_spawn-simple.c index 2df1013..e456792 100644 --- a/test/testsuite/thread_spawn-simple.c +++ b/test/testsuite/thread_spawn-simple.c @@ -19,7 +19,7 @@ void __wasi_thread_start_C(int thread_id, int *start_arg) { shared_t *data = (shared_t *)start_arg; - data->th_ready = 1; + __atomic_store_n(&data->th_ready, 1, __ATOMIC_SEQ_CST); __builtin_wasm_memory_atomic_notify(&data->th_ready, 1); // so we can have all the threads alive at the same time @@ -34,7 +34,7 @@ void __wasi_thread_start_C(int thread_id, int *start_arg) data->value += 8; data->tid = thread_id; - data->th_done = 1; + __atomic_store_n(&data->th_done, 1, __ATOMIC_SEQ_CST); __builtin_wasm_memory_atomic_notify(&data->th_done, 1); } @@ -57,6 +57,7 @@ int main(int argc, char **argv) for (i = 0; i < data_count; i++) { + __atomic_store_n(&data[i].th_continue, 1, __ATOMIC_SEQ_CST); __builtin_wasm_memory_atomic_notify(&data[i].th_continue, 1); }