diff options
-rw-r--r-- | winsup/cygwin/ChangeLog | 5 | ||||
-rw-r--r-- | winsup/cygwin/signal.cc | 19 |
2 files changed, 16 insertions, 8 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 338242830..3507f5a79 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,8 @@ +2000-09-16 Egor Duda <deo@logos-m.ru> + + * signal.cc (sleep): If interrupted by signal, return the + requested time minus the time actually slept. + Fri Sep 15 22:30:40 2000 Christopher Faylor <cgf@cygnus.com> * exceptions.cc (handle_exceptions): Just "core dump" if SIGSEGV in signal thread. diff --git a/winsup/cygwin/signal.cc b/winsup/cygwin/signal.cc index 00322018e..f1b4dca92 100644 --- a/winsup/cygwin/signal.cc +++ b/winsup/cygwin/signal.cc @@ -44,19 +44,22 @@ extern "C" unsigned int sleep (unsigned int seconds) { - int res; + int rc; unsigned start_time; + unsigned int res; start_time = GetTickCount (); syscall_printf ("sleep (%d)", seconds); - res = WaitForSingleObject (signal_arrived, seconds * 1000); - if (res == WAIT_TIMEOUT) - { - syscall_printf ("0 = sleep (%d)", seconds); - return 0; - } - return (GetTickCount () - start_time)/1000; + rc = WaitForSingleObject (signal_arrived, seconds * 1000); + if (rc == WAIT_TIMEOUT) + res = 0; + else + res = seconds - (GetTickCount () - start_time)/1000; + + syscall_printf ("%d = sleep (%d)", res, seconds); + + return res; } extern "C" |