delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1997/05/13/10:03:49

From: sos AT prospect DOT com DOT ru (Sergey Okhapkin)
Subject: RE: [b18] Can't interrupt "sleep 30"
13 May 1997 10:03:49 -0700 :
Approved: cygnus DOT gnu-win32 AT cygnus DOT com
Distribution: cygnus
Message-ID: <01BC5FB5.34ED0880.cygnus.gnu-win32@gater.krystalbank.msk.ru>
Original-To: "GNU-Win32 AT cygnus DOT com" <GNU-Win32 AT cygnus DOT com>,
"'Francis Litterio'"
<franl AT world DOT std DOT omit-this DOT com>
Original-Cc: "'Geoffrey Noer'" <noer AT cygnus DOT com>
Encoding: 38 TEXT
Original-Sender: owner-gnu-win32 AT cygnus DOT com

Francis Litterio wrote:
> Using b18, type
>
> 	sleep 30
>
> to bash, then type ^C to interrupt it.  Nothing happens, and after 30
> seconds elapses, bash prompts again.

Ok, it's my fault :-) While modifying signal support for B18 I forgot about 
sleep() and usleep() syscalls. Thank you for this bug report. The functions 
sleep() and usleep() in winsup/signal.cc must be the following one:

extern "C"
unsigned int
sleep (unsigned int seconds)
{
  syscall_printf ("sleep (%d);\n", seconds);
  WaitForSingleObject (u->signal_arrived, seconds * 1000);
  syscall_printf ("0 = sleep (%d)\n", seconds);
  return 0;
}

extern "C"
unsigned int
usleep (unsigned int useconds)
{
  syscall_printf ("usleep (%d)\n", useconds);
  WaitForSingleObject (u->signal_arrived, (useconds + 500) / 1000);
  syscall_printf ("0 = usleep (%d)\n", useconds);
  return 0;
}


--
Sergey Okhapkin
Moscow, Russia
Looking for a job.


-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request AT cygnus DOT com" with one line of text: "help".

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019