]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: remove unnecessary timeout in TestCallbackInAnotherThread
authorqmuntal <quimmuntal@gmail.com>
Thu, 31 Aug 2023 07:13:06 +0000 (09:13 +0200)
committerGopher Robot <gobot@golang.org>
Thu, 31 Aug 2023 16:31:35 +0000 (16:31 +0000)
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>
src/runtime/syscall_windows_test.go

index 1770b83e5d7b86372d181fdf1634687beb2b46e2..6a056c8d2b190cb86a51ed0ebf4f0bb3aae9914c 100644 (file)
@@ -265,11 +265,9 @@ func TestCallbackInAnotherThread(t *testing.T) {
        h := syscall.Handle(r)
        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:
                break
-       case syscall.WAIT_TIMEOUT:
-               t.Fatal("timeout waiting for thread to exit")
        case syscall.WAIT_FAILED:
                t.Fatalf("WaitForSingleObject failed: %v", err)
        default: