From 95a98b5efa7b4ca7bffb156f1af26235611a3923 Mon Sep 17 00:00:00 2001 From: Jim Kingdon Date: Sun, 8 Aug 1993 21:02:37 +0000 Subject: [PATCH] * ser-unix.c (hardwire_send_break) [HAVE_SGTTY]: Use select not usleep. --- gdb/ChangeLog | 2 ++ gdb/ser-unix.c | 18 ++++++++++++++---- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index f4c1d76dfb7..bb687295d73 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,7 @@ Sun Aug 8 13:59:49 1993 Jim Kingdon (kingdon@lioth.cygnus.com) + * ser-unix.c (hardwire_send_break) [HAVE_SGTTY]: Use select not usleep. + * remote.c: Add comments about 'd', 'r', and unrecognized requests. * inflow.c (terminal_init_inferior): Don't muck with tty state if diff --git a/gdb/ser-unix.c b/gdb/ser-unix.c index 9b67230a07a..353657aff07 100644 --- a/gdb/ser-unix.c +++ b/gdb/ser-unix.c @@ -359,10 +359,20 @@ hardwire_send_break (scb) #endif #ifdef HAVE_SGTTY - status = ioctl (scb->fd, TIOCSBRK, 0); - usleep (250000); - status = ioctl (scb->fd, TIOCCBRK, 0); - return status; + { + struct timeval timeout; + + status = ioctl (scb->fd, TIOCSBRK, 0); + + /* Can't use usleep; it doesn't exist in BSD 4.2. */ + /* Note that if this select() is interrupted by a signal it will not wait + the full length of time. I think that is OK. */ + timeout.tv_sec = 0; + timeout.tv_usec = 250000; + select (0, 0, 0, 0, &timeout); + status = ioctl (scb->fd, TIOCCBRK, 0); + return status; + } #endif } -- 2.30.2