[libcxx-commits] [libcxx] r367048 - [NFC][libcxx] Add comments about making mutex/condition_variable trivial on Apple platforms

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Thu Jul 25 13:29:20 PDT 2019


Author: ldionne
Date: Thu Jul 25 13:29:20 2019
New Revision: 367048

URL: http://llvm.org/viewvc/llvm-project?rev=367048&view=rev
Log:
[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.

Modified:
    libcxx/trunk/include/__config

Modified: libcxx/trunk/include/__config
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__config?rev=367048&r1=367047&r2=367048&view=diff
==============================================================================
--- libcxx/trunk/include/__config (original)
+++ libcxx/trunk/include/__config Thu Jul 25 13:29:20 2019
@@ -1097,17 +1097,27 @@ _LIBCPP_FUNC_VIS extern "C" void __sanit
        _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)




More information about the libcxx-commits mailing list