Chromium Code Reviews| 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); |
| } |