aboutsummaryrefslogtreecommitdiff
path: root/gdb/windows-nat.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/windows-nat.c')
-rw-r--r--gdb/windows-nat.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c
index e73a275..939c581 100644
--- a/gdb/windows-nat.c
+++ b/gdb/windows-nat.c
@@ -1,6 +1,6 @@
/* Target-vector operations for controlling windows child processes, for GDB.
- Copyright (C) 1995-2024 Free Software Foundation, Inc.
+ Copyright (C) 1995-2025 Free Software Foundation, Inc.
Contributed by Cygnus Solutions, A Red Hat Company.
@@ -56,7 +56,6 @@
#include "cli/cli-style.h"
#include <unistd.h>
#include "exec.h"
-#include "solist.h"
#include "solib.h"
#include "xml-support.h"
#include "inttypes.h"
@@ -433,7 +432,12 @@ wait_for_single (HANDLE handle, DWORD howlong)
{
while (true)
{
- DWORD r = WaitForSingleObject (handle, howlong);
+ /* Using an INFINITE argument to WaitForSingleObject may cause a system
+ deadlock. Avoid it by waiting for a bit in a loop instead. */
+ DWORD milliseconds = howlong == INFINITE ? 100 : howlong;
+ DWORD r = WaitForSingleObject (handle, milliseconds);
+ if (howlong == INFINITE && r == WAIT_TIMEOUT)
+ continue;
if (r == WAIT_OBJECT_0)
return;
if (r == WAIT_FAILED)