OSDN Git Service

Change timeout granularity of gdbloop() and gdbloop_poll() from seconds
authorkevinb <kevinb>
Thu, 16 Mar 2006 23:11:42 +0000 (23:11 +0000)
committerkevinb <kevinb>
Thu, 16 Mar 2006 23:11:42 +0000 (23:11 +0000)
to milliseconds.

rda/ChangeLog
rda/include/gdbloop.h
rda/lib/gdbloop.c
rda/unix/ChangeLog
rda/unix/server.c
rda/win32/ChangeLog
rda/win32/server.cc

index eb2e040..747b524 100644 (file)
@@ -1,3 +1,11 @@
+2006-03-16  Kevin Buettner  <kevinb@redhat.com>
+
+       * include/gdbloop.h (gdbloop, gdbloop_poll): Revise comments
+       to indicate that timeout granulatiry is now in milliseconds
+       rather than seconds.
+       * lib/gdbloop.c (poll_gdbsocket): Change ``timeout'' granulatiry
+       from seconds to milliseconds.
+
 2005-03-03  Kevin Buettner  <kevinb@redhat.com>
 
        * lib/crc32.h, lib/crc32.c: New files.
index 70a5559..3b9cca2 100644 (file)
@@ -34,13 +34,17 @@ extern "C" {
 
 /* Really simple minded event-loop.  Assumes that the target is using
    both gdbsocket* and gdbsched* to implement things. If TIMEOUT is
-   negative, block infinitely.  If TIMEOUT is zero, don't block.  */
+   negative, block infinitely.  If TIMEOUT is zero, don't block.
+   Otherwise, a positive timeout represents the time in milliseconds
+   to wait.  */
 
 void gdbloop (long current_time, int timeout);
 
-/* Even more simple minded event-loop.  Assumes that everything is in
-   units of one second.  Calls gdbloop() above, using time() for
-   CURRENT_TIME.  */
+/* An even more simple minded event-loop.  Calls gdbloop()
+   above, using time() for CURRENT_TIME.  TIMEOUT is as above
+   in which a negative TIMEOUT will block indefinitely, a zero
+   timeout won't block at all, and a positive TIMEOUT will
+   block for (at most) the specified number of milliseconds.  */
 
 void gdbloop_poll (int timeout);
 
index 156c6db..2a73060 100644 (file)
@@ -86,7 +86,7 @@ fds_isset (int fd, void *context, enum gdbsocket_fd_event event)
 }
 
 static void
-poll_gdbsocket (long timeout)
+poll_gdbsocket (long timeout /* in milliseconds */)
 {
   int s;
   struct fds fds;
@@ -103,8 +103,8 @@ poll_gdbsocket (long timeout)
   if (timeout >= 0)
     {
       struct timeval timeval;
-      timeval.tv_sec = timeout;
-      timeval.tv_usec = 0;
+      timeval.tv_sec = timeout / 1000;
+      timeval.tv_usec = (timeout % 1000) * 1000;
       s = select (fds.nr, &fds.read, &fds.write, NULL, &timeval);
     }
   else
index 38fdb16..80c57f8 100644 (file)
@@ -1,3 +1,8 @@
+2006-03-16  Kevin Buettner  <kevinb@redhat.com>
+
+       * server.c (main): Change polling interval for gdbloop_poll()
+       from one second to ten milliseconds.
+
 2005-12-07  Kevin Buettner  <kevinb@redhat.com>
 
        * ptrace-target.c (ptrace_compute_signal, ptrace_process_signal):
index 2d166f0..407d9d3 100644 (file)
@@ -413,7 +413,7 @@ main (int argc, char **argv)
   /* Poll for socket traffic. */
   while (! server_quit_p)
     {
-      gdbloop_poll (1 /* second */);
+      gdbloop_poll (10 /* milliseconds */);
       if (! server_quit_p)
        {
          if (gdbserver.check_child_state (process))
index dc88883..310ba37 100644 (file)
@@ -1,3 +1,8 @@
+2006-03-16  Kevin Buettner  <kevinb@redhat.com>
+
+       * server.c (main): Revise comment to indicate that polling
+       granularity is milliseconds.
+
 2004-12-09  Jim Blandy  <jimb@redhat.com>
 
        * configure.in: Remove nonsense test.
index b812984..0ee30c4 100644 (file)
@@ -120,7 +120,7 @@ main (int argc, char **argv)
   /* Poll for socket traffic. */
   while (! process->quit_server ())
     {
-      gdbloop_poll (0 /* second */);
+      gdbloop_poll (0 /* milliseconds */);
       if (process->check_state ())
        {
          switch (process->status ())