OSDN Git Service

Apply sleep_cancel patch
authortpfaff <tpfaff>
Tue, 14 Jan 2003 20:05:48 +0000 (20:05 +0000)
committertpfaff <tpfaff>
Tue, 14 Jan 2003 20:05:48 +0000 (20:05 +0000)
winsup/cygwin/ChangeLog
winsup/cygwin/signal.cc

index bc40e20..8ddb861 100644 (file)
@@ -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.
index a23487f..c852907 100644 (file)
@@ -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;
 }