diff options
author | Thomas Pfaff <tpfaff@gmx.net> | 2003-01-14 20:05:49 +0000 |
---|---|---|
committer | Thomas Pfaff <tpfaff@gmx.net> | 2003-01-14 20:05:49 +0000 |
commit | 7ec66a2c28257d1dc25b08f457b9030bf4528d6f (patch) | |
tree | 21c48205462bd02a2771d50d7248931eb67e4549 | |
parent | d83b482409d4e776ed93ae813905fe90a7c17d10 (diff) | |
download | newlib-7ec66a2c28257d1dc25b08f457b9030bf4528d6f.zip newlib-7ec66a2c28257d1dc25b08f457b9030bf4528d6f.tar.gz newlib-7ec66a2c28257d1dc25b08f457b9030bf4528d6f.tar.bz2 |
Apply sleep_cancel patch
-rw-r--r-- | winsup/cygwin/ChangeLog | 8 | ||||
-rw-r--r-- | winsup/cygwin/signal.cc | 8 |
2 files changed, 13 insertions, 3 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index bc40e20..8ddb861 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,4 +1,10 @@ -2003-01-10 Thomas Pfaff <tpfaff@gmx.net> +2003-01-14 Thomas Pfaff <tpfaff@gmx.net> + + * signal.cc (sleep): Add pthread_testcancel call. + Wait for signal and cancellation event. + (usleep): Ditto. + +2003-01-14 Thomas Pfaff <tpfaff@gmx.net> * exceptions.cc (handle_sigsuspend): Add pthread_testcancel call. Wait for signal and cancellation event. diff --git a/winsup/cygwin/signal.cc b/winsup/cygwin/signal.cc index a23487f..c852907 100644 --- a/winsup/cygwin/signal.cc +++ b/winsup/cygwin/signal.cc @@ -74,12 +74,14 @@ sleep (unsigned int seconds) sigframe thisframe (mainthread); DWORD ms, start_time, end_time; + pthread_testcancel (); + ms = seconds * 1000; start_time = GetTickCount (); end_time = start_time + (seconds * 1000); syscall_printf ("sleep (%d)", seconds); - rc = WaitForSingleObject (signal_arrived, ms); + rc = pthread::cancelable_wait (signal_arrived, ms); DWORD now = GetTickCount (); if (rc == WAIT_TIMEOUT || now >= end_time) ms = 0; @@ -97,9 +99,11 @@ sleep (unsigned int seconds) extern "C" unsigned int usleep (unsigned int useconds) { + pthread_testcancel (); + sig_dispatch_pending (0); syscall_printf ("usleep (%d)", useconds); - WaitForSingleObject (signal_arrived, (useconds + 500) / 1000); + pthread::cancelable_wait (signal_arrived, (useconds + 500) / 1000); syscall_printf ("0 = usleep (%d)", useconds); return 0; } |