Index: src/platform-macos.cc |
diff --git a/src/platform-macos.cc b/src/platform-macos.cc |
index a937ed3a5c12c580a2c26e36611e6070aa2ee2dc..50f909888ff7ef2d3d5d1d732a2d6859c3544161 100644 |
--- a/src/platform-macos.cc |
+++ b/src/platform-macos.cc |
@@ -682,17 +682,28 @@ Mutex* OS::CreateMutex() { |
class MacOSSemaphore : public Semaphore { |
public: |
explicit MacOSSemaphore(int count) { |
- semaphore_create(mach_task_self(), &semaphore_, SYNC_POLICY_FIFO, count); |
+ int r; |
+ r = semaphore_create(mach_task_self(), |
+ &semaphore_, |
+ SYNC_POLICY_FIFO, |
+ count); |
+ ASSERT(r == KERN_SUCCESS); |
} |
~MacOSSemaphore() { |
- semaphore_destroy(mach_task_self(), semaphore_); |
+ int r; |
+ r = semaphore_destroy(mach_task_self(), semaphore_); |
+ ASSERT(r == KERN_SUCCESS); |
} |
- // The MacOS mach semaphore documentation claims it does not have spurious |
- // wakeups, the way pthreads semaphores do. So the code from the linux |
- // platform is not needed here. |
- void Wait() { semaphore_wait(semaphore_); } |
+ void Wait() { |
+ int r; |
+ do { |
+ r = semaphore_wait(semaphore_); |
+ } while (r == KERN_ABORTED); |
+ |
+ ASSERT(r == KERN_SUCCESS); |
Erik Corry
2012/08/23 09:23:39
I will move this up into the loop and assert that
|
+ } |
bool Wait(int timeout); |