Skip to content

Commit 74824ba

Browse files
authored
fix: update test to use atomic store (#32)
1 parent 27fcb69 commit 74824ba

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

test/testsuite/thread_spawn-simple.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ void __wasi_thread_start_C(int thread_id, int *start_arg)
1919
{
2020
shared_t *data = (shared_t *)start_arg;
2121

22-
data->th_ready = 1;
22+
__atomic_store_n(&data->th_ready, 1, __ATOMIC_SEQ_CST);
2323
__builtin_wasm_memory_atomic_notify(&data->th_ready, 1);
2424

2525
// 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)
3434
data->value += 8;
3535
data->tid = thread_id;
3636

37-
data->th_done = 1;
37+
__atomic_store_n(&data->th_done, 1, __ATOMIC_SEQ_CST);
3838
__builtin_wasm_memory_atomic_notify(&data->th_done, 1);
3939
}
4040

@@ -57,6 +57,7 @@ int main(int argc, char **argv)
5757

5858
for (i = 0; i < data_count; i++)
5959
{
60+
__atomic_store_n(&data[i].th_continue, 1, __ATOMIC_SEQ_CST);
6061
__builtin_wasm_memory_atomic_notify(&data[i].th_continue, 1);
6162
}
6263

0 commit comments

Comments
 (0)