fix(sdk-ios): check semaphore wait result and throw on snapshot timeout

dispatch_semaphore_wait returns nonzero on timeout; ignoring the return
value caused pauseAndSnapshot to silently return an empty map, sending a
garbage empty STATE frame to the host. Now throws so the agent loop
reconnects instead.
This commit is contained in:
pj committed 2026-04-23 16:34:32 +07:00
1 parent 73dc7948ab
commit b36167cf47
1 file changed
+2 -1
@@ -15,7 +15,8 @@ internal object IosPauser {
dispatch_semaphore_signal(snapshotReady)
dispatch_semaphore_wait(resumeGate, dispatch_time(DISPATCH_TIME_NOW, 5_000_000_000L))
}
dispatch_semaphore_wait(snapshotReady, dispatch_time(DISPATCH_TIME_NOW, 5_000_000_000L))
val waited = dispatch_semaphore_wait(snapshotReady, dispatch_time(DISPATCH_TIME_NOW, 5_000_000_000L))
check(waited == 0L) { "snapshot timed out: main thread did not signal within 5s" }
return capturedSnapshot
}