diff options
| author | Louis Dionne <ldionne@apple.com> | 2019-07-25 20:29:20 +0000 |
|---|---|---|
| committer | Louis Dionne <ldionne@apple.com> | 2019-07-25 20:29:20 +0000 |
| commit | 568bb7eeb6ffe824576a6a8fca7bd90efd44d20c (patch) | |
| tree | f6b828ed9aa650309f07cdb3444a284c0949f476 | |
| parent | e1c159e86ac2f109d0d4d9342721ce78532660cf (diff) | |
| download | bcm5719-llvm-568bb7eeb6ffe824576a6a8fca7bd90efd44d20c.tar.gz bcm5719-llvm-568bb7eeb6ffe824576a6a8fca7bd90efd44d20c.zip | |
[NFC][libcxx] Add comments about making mutex/condition_variable trivial on Apple platforms
Leaving some comments behind so that we avoid re-having that discussion
in the future.
llvm-svn: 367048
| -rw-r--r-- | libcxx/include/__config | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/libcxx/include/__config b/libcxx/include/__config index 61ca5447976..682b9909b3c 100644 --- a/libcxx/include/__config +++ b/libcxx/include/__config @@ -1097,17 +1097,27 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container( _LIBCPP_HAS_NO_THREADS is defined. #endif -// The Apple, glibc, and Bionic implementation of pthreads implements +// The glibc and Bionic implementation of pthreads implements // pthread_mutex_destroy as nop for regular mutexes. Additionally, Win32 // mutexes have no destroy mechanism. -// TODO(EricWF): Enable this optimization on Apple and Bionic platforms after -// speaking to their respective stakeholders. +// +// This optimization can't be performed on Apple platforms, where +// pthread_mutex_destroy can allow the kernel to release resources. +// See https://llvm.org/D64298 for details. +// +// TODO(EricWF): Enable this optimization on Bionic after speaking to their +// respective stakeholders. #if (defined(_LIBCPP_HAS_THREAD_API_PTHREAD) && defined(__GLIBC__)) \ || defined(_LIBCPP_HAS_THREAD_API_WIN32) # define _LIBCPP_HAS_TRIVIAL_MUTEX_DESTRUCTION #endif // Destroying a condvar is a nop on Windows. +// +// This optimization can't be performed on Apple platforms, where +// pthread_cond_destroy can allow the kernel to release resources. +// See https://llvm.org/D64298 for details. +// // TODO(EricWF): This is potentially true for some pthread implementations // as well. #if defined(_LIBCPP_HAS_THREAD_API_WIN32) |

