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

Unified Diff: base/synchronization/condition_variable_posix.cc

Issue 1323293005: mac: Add a hack to condition_variable_posix.cc to avoid a crash. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 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: base/synchronization/condition_variable_posix.cc
diff --git a/base/synchronization/condition_variable_posix.cc b/base/synchronization/condition_variable_posix.cc
index 013284c888f72993b81a75f0b56a28bd653e6e3a..c9a2ec43f829e7fdbb73351e8739ad5e699150eb 100644
--- a/base/synchronization/condition_variable_posix.cc
+++ b/base/synchronization/condition_variable_posix.cc
@@ -42,6 +42,20 @@ ConditionVariable::ConditionVariable(Lock* user_lock)
}
ConditionVariable::~ConditionVariable() {
+#if defined(OS_MACOSX)
+ // This hack is necessary to avoid a fatal pthreads subsystem bug in the
+ // Darwin kernel. http://crbug.com/517681.
+ {
Mark Mentovai 2015/09/04 12:30:56 The bug says 10.10 and 10.11. Does this happen on
erikchen 2015/09/04 17:25:37 It does - the comment was looking only at the most
+ base::Lock lock;
Mark Mentovai 2015/09/04 12:30:56 How do we know that the memory used for this mutex
erikchen 2015/09/04 17:25:37 We could, soon after each new thread is created, m
+ base::AutoLock l(lock);
+ struct timespec ts;
+ ts.tv_sec = 0;
+ ts.tv_nsec = 1;
+ pthread_cond_timedwait_relative_np(&condition_, lock.lock_.native_handle(),
+ &ts);
+ }
+#endif
+
int rv = pthread_cond_destroy(&condition_);
DCHECK_EQ(0, rv);
}
« 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