diff options
author | Keith Seitz <keiths@cygnus> | 1998-05-24 21:05:12 +0000 |
---|---|---|
committer | Keith Seitz <keiths@cygnus> | 1998-05-24 21:05:12 +0000 |
commit | 21b3bc779ca64a3b1d39886a74f0304c8dc96368 (patch) | |
tree | 9787fccc250279c4770c3406e0bad5a3d6f83ab0 /gdb/ser-unix.c | |
parent | aa81c3ca9905bce9ae34908f82cc81961227a512 (diff) | |
download | gdb-21b3bc779ca64a3b1d39886a74f0304c8dc96368.zip gdb-21b3bc779ca64a3b1d39886a74f0304c8dc96368.tar.gz gdb-21b3bc779ca64a3b1d39886a74f0304c8dc96368.tar.bz2 |
* ser-unix.c (wait_for): Do not reset timeout_remaining for cygwin32 so
that
we can use this member to track real timeouts.
(hardwire_readchar): Modify for cygwin32 so that we only ever use a real
system timeout of one second. Track the "real" timeout as a series of th
ese
one second timeouts.
Call ui_loop_hook to keep the gui alive.
* top.c: Define new hook for cygwin32, "ui_loop_hook".
* gdbtk.c (gdbtk_init): Add ui_loop_hook for CygWin32 to work around
update problems.
Diffstat (limited to 'gdb/ser-unix.c')
-rw-r--r-- | gdb/ser-unix.c | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/gdb/ser-unix.c b/gdb/ser-unix.c index c365434..81374ea 100644 --- a/gdb/ser-unix.c +++ b/gdb/ser-unix.c @@ -83,6 +83,10 @@ static int hardwire_flush_input PARAMS ((serial_t)); static int hardwire_send_break PARAMS ((serial_t)); static int hardwire_setstopbits PARAMS ((serial_t, int)); +#ifdef __CYGWIN32__ +extern void ui_loop_hook PARAMS ((int)); +#endif + /* Open up a real live device for serial I/O */ static int @@ -430,7 +434,9 @@ wait_for(scb, timeout) serial_t scb; int timeout; { +#ifndef __CYGWIN32__ scb->timeout_remaining = 0; +#endif #ifdef HAVE_SGTTY { @@ -539,21 +545,34 @@ wait_for(scb, timeout) to wait, or -1 to wait forever. Use timeout of 0 to effect a poll. Returns char if successful. Returns SERIAL_TIMEOUT if timeout expired, EOF if line dropped dead, or SERIAL_ERROR for any other error (see errno in that case). */ - static int hardwire_readchar(scb, timeout) serial_t scb; int timeout; { - int status; + int status, t; if (scb->bufcnt-- > 0) return *scb->bufp++; +#ifdef __CYGWIN32__ + if (timeout > 0) + timeout++; +#endif + while (1) { +#ifdef __CYGWIN32__ + t = timeout == 0 ? 0 : 1; + scb->timeout_remaining = timeout < 0 ? timeout : timeout - t; + status = wait_for (scb, t); + + /* -2 means disable timer */ + if (ui_loop_hook) + ui_loop_hook (-2); +#else status = wait_for (scb, timeout); - +#endif if (status < 0) return status; @@ -570,6 +589,10 @@ hardwire_readchar(scb, timeout) timeout = scb->timeout_remaining; continue; } +#ifdef __CYGWIN32__ + else if (scb->timeout_remaining < 0) + continue; +#endif else return SERIAL_TIMEOUT; } |