1;; test that looping notify eventually unblocks a parallel waiting thread 2(module $Mem 3 (memory (export "shared") 1 1 shared) 4) 5 6(thread $T1 (shared (module $Mem)) 7 (register "mem" $Mem) 8 (module 9 (memory (import "mem" "shared") 1 10 shared) 10 (func (export "run") (result i32) 11 (memory.atomic.wait32 (i32.const 0) (i32.const 0) (i64.const -1)) 12 ) 13 ) 14 ;; test that this thread eventually gets unblocked 15 (assert_return (invoke "run") (i32.const 0)) 16) 17 18(thread $T2 (shared (module $Mem)) 19 (register "mem" $Mem) 20 (module 21 (memory (import "mem" "shared") 1 1 shared) 22 (func (export "notify-0") (result i32) 23 (memory.atomic.notify (i32.const 0) (i32.const 0)) 24 ) 25 (func (export "notify-1-while") 26 (loop 27 (i32.const 1) 28 (memory.atomic.notify (i32.const 0) (i32.const 1)) 29 (i32.ne) 30 (br_if 0) 31 ) 32 ) 33 ) 34 ;; notifying with a count of 0 will not unblock 35 (assert_return (invoke "notify-0") (i32.const 0)) 36 ;; loop until something is notified 37 (assert_return (invoke "notify-1-while")) 38) 39 40(wait $T1) 41(wait $T2) 42