* configure.ac (DEBUGDIR_RELOCATABLE): Define for debugdir inside
[deliverable/binutils-gdb.git] / gdb / mingw-hdep.c
index 79b23dc2556b65669676678069298d81cb0a69c0..25eebca9c63214b9b89935c212e6ab61e8ee69f9 100644 (file)
@@ -1,7 +1,6 @@
 /* Host support routines for MinGW, for GDB, the GNU debugger.
 
-   Copyright (C) 2006
-   Free Software Foundation, Inc.
+   Copyright (C) 2006, 2007 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -105,8 +104,8 @@ gdb_select (int n, fd_set *readfds, fd_set *writefds, fd_set *exceptfds,
         if something starts using it.  */
       gdb_assert (!writefds || !FD_ISSET (fd, writefds));
 
-      if (!FD_ISSET (fd, readfds)
-         && !FD_ISSET (fd, exceptfds))
+      if ((!readfds || !FD_ISSET (fd, readfds))
+         && (!exceptfds || !FD_ISSET (fd, exceptfds)))
        continue;
       h = (HANDLE) _get_osfhandle (fd);
 
@@ -124,13 +123,13 @@ gdb_select (int n, fd_set *readfds, fd_set *writefds, fd_set *exceptfds,
          except = never_handle;
        }
 
-      if (FD_ISSET (fd, readfds))
+      if (readfds && FD_ISSET (fd, readfds))
        {
          gdb_assert (num_handles < MAXIMUM_WAIT_OBJECTS);
          handles[num_handles++] = read;
        }
 
-      if (FD_ISSET (fd, exceptfds))
+      if (exceptfds && FD_ISSET (fd, exceptfds))
        {
          gdb_assert (num_handles < MAXIMUM_WAIT_OBJECTS);
          handles[num_handles++] = except;
@@ -167,8 +166,13 @@ gdb_select (int n, fd_set *readfds, fd_set *writefds, fd_set *exceptfds,
   for (fd = 0, indx = 0; fd < n; ++fd)
     {
       HANDLE fd_h;
+      struct serial *scb;
+
+      if ((!readfds || !FD_ISSET (fd, readfds))
+         && (!exceptfds || !FD_ISSET (fd, exceptfds)))
+       continue;
 
-      if (FD_ISSET (fd, readfds))
+      if (readfds && FD_ISSET (fd, readfds))
        {
          fd_h = handles[indx++];
          /* This handle might be ready, even though it wasn't the handle
@@ -179,7 +183,7 @@ gdb_select (int n, fd_set *readfds, fd_set *writefds, fd_set *exceptfds,
            num_ready++;
        }
 
-      if (FD_ISSET (fd, exceptfds))
+      if (exceptfds && FD_ISSET (fd, exceptfds))
        {
          fd_h = handles[indx++];
          /* This handle might be ready, even though it wasn't the handle
@@ -189,6 +193,12 @@ gdb_select (int n, fd_set *readfds, fd_set *writefds, fd_set *exceptfds,
          else
            num_ready++;
        }
+
+      /* We created at least one event handle for this fd.  Let the
+        device know we are finished with it.  */
+      scb = serial_for_fd (fd);
+      if (scb)
+       serial_done_wait_handle (scb);
     }
 
   return num_ready;
This page took 0.025168 seconds and 4 git commands to generate.