Skip to content

Commit 7fbf1bb

Browse files
committed
[bfops/wasm-test]: comment
1 parent 578ba04 commit 7fbf1bb

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

  • sdks/rust/tests/test-counter/src

sdks/rust/tests/test-counter/src/lib.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,9 +131,12 @@ impl TestCounter {
131131
const WAIT_INTERVAL_MS: u32 = 10;
132132
const MAX_WAIT_ITERATIONS: u32 = (TEST_TIMEOUT_SECS as u32 * 1000) / WAIT_INTERVAL_MS;
133133

134-
// On wasm/web the SDK message loop runs on the same single-threaded event loop
135-
// as test code. Blocking on a Condvar here can deadlock callbacks forever.
136-
// We poll with timer yields so websocket/callback tasks can continue to run.
134+
// Native can block on a Condvar because callbacks keep moving on a different SDK thread.
135+
// wasm/web does not have that escape hatch in this harness: the websocket/message loop and
136+
// the test body share the same single-threaded JS event loop, so blocking here would stop
137+
// callback delivery entirely. We poll with timer yields so websocket/callback tasks can
138+
// continue to run, and then do the same final pass native uses to convert recorded failures
139+
// into a panic.
137140
let all_tests_finished = || {
138141
let inner = self.inner.lock().expect("TestCounterInner Mutex is poisoned");
139142
inner.outcomes.len() == inner.registered.len()

0 commit comments

Comments
 (0)