* signal.cc (sleep): If interrupted by signal, return the

requested time minus the time actually slept.
This commit is contained in:
Egor Duda 2000-09-16 13:19:52 +00:00
parent f9f2ed0e2b
commit a12b2260d0
2 changed files with 16 additions and 8 deletions

View File

@ -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.

View File

@ -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"