Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(49)

Unified Diff: src/base/platform/condition-variable.cc

Issue 1959643002: [Mac] Work around potential pthread_mutex_destroy crashes (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fix compilation Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698