[libdispatch-changes] [139] trunk/src/semaphore.c

source_changes at macosforge.org source_changes at macosforge.org
Thu Nov 5 07:15:21 PST 2009


Revision: 139
          http://trac.macosforge.org/projects/libdispatch/changeset/139
Author:   robert at fledge.watson.org
Date:     2009-11-05 07:15:18 -0800 (Thu, 05 Nov 2009)
Log Message:
-----------
Move 'nsec' definition into #if USE_MACH_SEM as it's no longer required
with sem_timedwait().

Fix another instance of the sem_timedwait() return value checking bug.

Modified Paths:
--------------
    trunk/src/semaphore.c

Modified: trunk/src/semaphore.c
===================================================================
--- trunk/src/semaphore.c	2009-11-05 10:34:37 UTC (rev 138)
+++ trunk/src/semaphore.c	2009-11-05 15:15:18 UTC (rev 139)
@@ -155,12 +155,12 @@
 #if USE_MACH_SEM
 	mach_timespec_t _timeout;
 	kern_return_t kr;
+	uint64_t nsec;
 #endif
 #if USE_POSIX_SEM
 	struct timespec _timeout;
 	int ret;
 #endif
-	uint64_t nsec;
 	long orig;
 	
 again:
@@ -440,12 +440,12 @@
 #if USE_MACH_SEM
 	mach_timespec_t _timeout;
 	kern_return_t kr;
+	uint64_t nsec;
 #endif
 #if USE_POSIX_SEM
 	struct timespec _timeout;
 	int ret;
 #endif
-	uint64_t nsec;
 	long orig;
 	
 again:
@@ -494,7 +494,8 @@
 			ret = slowpath(sem_timedwait(&dsema->dsema_sem,
 			    &_timeout));
 		} while (ret == -1 && errno == EINTR);
-		if (ret == 0 || errno != ETIMEDOUT) {
+
+		if (!(ret == -1 && errno == ETIMEDOUT)) {
 			DISPATCH_SEMAPHORE_VERIFY_RET(ret);
 			break;
 		}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/libdispatch-changes/attachments/20091105/a70b9f07/attachment.html>


More information about the libdispatch-changes mailing list