runtime: remove unnecessary timeout in TestCallbackInAnotherThread

Waiting only for 100ms might be not enough for the callback to be
called. It is more reliable to wait infinitely and rely on the
test timeout to fail the test if the callback is not called.

Fixes #62206

Change-Id: I06b5eadae1dd334a2afc41af31a44b42cb5e596d
Reviewed-on: https://go-review.googlesource.com/c/go/+/524695
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Quim Muntal <quimmuntal@gmail.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Quim Muntal <quimmuntal@gmail.com>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
This commit is contained in:
qmuntal 2023-08-31 09:13:06 +02:00 committed by Gopher Robot
parent 9aaf5234bf
commit cab416f339
1 changed files with 1 additions and 3 deletions

View File

@ -265,11 +265,9 @@ func TestCallbackInAnotherThread(t *testing.T) {
h := syscall.Handle(r) h := syscall.Handle(r)
defer syscall.CloseHandle(h) defer syscall.CloseHandle(h)
switch s, err := syscall.WaitForSingleObject(h, 100); s { switch s, err := syscall.WaitForSingleObject(h, syscall.INFINITE); s {
case syscall.WAIT_OBJECT_0: case syscall.WAIT_OBJECT_0:
break break
case syscall.WAIT_TIMEOUT:
t.Fatal("timeout waiting for thread to exit")
case syscall.WAIT_FAILED: case syscall.WAIT_FAILED:
t.Fatalf("WaitForSingleObject failed: %v", err) t.Fatalf("WaitForSingleObject failed: %v", err)
default: default: