Index: src/base/platform/condition-variable.cc |
diff --git a/src/base/platform/condition-variable.cc b/src/base/platform/condition-variable.cc |
index fcd6cf7974da4aa093d02887c8d0cc710163f65f..19c33f8b1f75d11493ea611f103065bb99012eb3 100644 |
--- a/src/base/platform/condition-variable.cc |
+++ b/src/base/platform/condition-variable.cc |
@@ -36,6 +36,19 @@ ConditionVariable::ConditionVariable() { |
ConditionVariable::~ConditionVariable() { |
+#if defined(V8_OS_MACOSX) |
+ // This hack is necessary to avoid a fatal pthreads subsystem bug in the |
+ // Darwin kernel. http://crbug.com/517681. |
+ { |
+ Mutex lock; |
+ LockGuard<Mutex> l(&lock); |
+ struct timespec ts; |
+ ts.tv_sec = 0; |
+ ts.tv_nsec = 1; |
+ pthread_cond_timedwait_relative_np(&native_handle_, &lock.native_handle(), |
+ &ts); |
+ } |
+#endif |
int result = pthread_cond_destroy(&native_handle_); |
DCHECK_EQ(0, result); |
USE(result); |