diff options
Diffstat (limited to 'sim/common/sim-io.c')
-rw-r--r-- | sim/common/sim-io.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/sim/common/sim-io.c b/sim/common/sim-io.c index f3d2f674a64..26f44451a30 100644 --- a/sim/common/sim-io.c +++ b/sim/common/sim-io.c @@ -33,6 +33,13 @@ #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); + } } |