import gdb-19990422 snapshot
[deliverable/binutils-gdb.git] / sim / common / sim-io.c
index f3d2f674a64e3c397d6eb32ad641856d68db54b3..26f44451a30fb606a0e94740098ef6a044cb84f2 100644 (file)
 #include <unistd.h>
 #endif
 
+/* Define the rate at which the simulator should poll the host
+   for a quit. */
+#ifndef POLL_QUIT_INTERVAL
+#define POLL_QUIT_INTERVAL 0x10
+#endif
+
+static int poll_quit_count = POLL_QUIT_INTERVAL;
 
 /* See the file include/callbacks.h for a description */
 
@@ -304,9 +311,12 @@ sim_io_error(SIM_DESC sd,
 void
 sim_io_poll_quit(SIM_DESC sd)
 {
-  if (STATE_CALLBACK (sd)->poll_quit != NULL)
-    if (STATE_CALLBACK (sd)->poll_quit (STATE_CALLBACK (sd)))
-      sim_stop (sd);
+  if (STATE_CALLBACK (sd)->poll_quit != NULL && poll_quit_count-- < 0)
+    {
+      poll_quit_count = POLL_QUIT_INTERVAL;
+      if (STATE_CALLBACK (sd)->poll_quit (STATE_CALLBACK (sd)))
+       sim_stop (sd);
+    }
 }
 
 
This page took 0.023582 seconds and 4 git commands to generate.