changeset 2231:e11e2c73b1b2

* src/time.cxx: (nanosleep): Fixed to return EINTR when it is interrupted by a signal. This in turn fixed sleep() to return the number of unelapsed seconds when interrupted by a signal.
author asl
date Fri, 16 Jun 2006 18:21:16 +0000
parents 6d4ac428ab51
children 8e3602f394e2
files packages/compat/posix/current/ChangeLog packages/compat/posix/current/src/time.cxx
diffstat 2 files changed, 11 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/packages/compat/posix/current/ChangeLog
+++ b/packages/compat/posix/current/ChangeLog
@@ -1,3 +1,9 @@
+2006-06-13  Dan Jakubiec  <dan.jakubiec@systech.com>
+
+	* src/time.cxx: (nanosleep): Fixed to return EINTR when it is
+	interrupted by a signal.  This in turn fixed sleep() to return the
+	number of unelapsed seconds when interrupted by a signal.
+
 2006-06-12  Klaas Gadeyne  <klaas.gadeyne@fmtc.be>
 
 	* src/pthread.cxx (pthread_create): name is only defined if
--- a/packages/compat/posix/current/src/time.cxx
+++ b/packages/compat/posix/current/src/time.cxx
@@ -665,6 +665,11 @@ externC int nanosleep( const struct time
         ticks -= (now-then);
 
         cyg_ticks_to_timespec( ticks, rmtp );
+
+        // Check for cancellation and then notify the caller that we
+        // were interrupted.
+        PTHREAD_TESTCANCEL();
+        TIME_RETURN(EINTR);
     }
     
     // check if we were woken up because we were cancelled.