[PATCH] D27575: [libcxxabi] Introduce an externally threaded libc++abi variant (take-2)

Asiri Rathnayake via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Dec 12 02:34:32 PST 2016


rmaprath added inline comments.


================
Comment at: CMakeLists.txt:121
 option(LIBCXXABI_HAS_PTHREAD_API "Ignore auto-detection and force use of pthread API" OFF)
+option(LIBCXXABI_HAS_EXTERNAL_THREAD_API
+  "Build libc++abi with an externalized threading API.
----------------
EricWF wrote:
> Maybe use a dependent option that sets it to the value of `LIBCXX_ENABLE_THREADS` when it is defined?
Are you referring to `CMAKE_DEPENDENT_OPTION` macro? I don't see this macro used anywhere else in llvm, but I suppose that's not a concern?

Although, it would have to be something like:

```
CMAKE_DEPENDENT_OPTION(LIBCXXABI_HAS_EXTERNAL_THREAD_API "Externally Threaded libcxxabi" OFF  "LIBCXX_ENABLE_THREADS" OFF)
```

Because, `LIBCXX_ENABLE_THREADS=ON` should not mean `LIBCXXABI_HAS_EXTERNAL_THREAD_API=ON`.



================
Comment at: src/fallback_malloc.cpp:37
 class mutexor {
 public:
----------------
EricWF wrote:
> Can't we replace this class with `std::mutex` directly?
Again, I should've included more context to the patch :(

The `mutexor` here is supposed to degrade to a nop when threading is disabled. I think we cannot use `std::mutex` without threading support.

Will update the patch with more context.


================
Comment at: test/test_exception_storage.pass.cpp:42
 size_t                 thread_globals [ NUMTHREADS ] = { 0 };
-__libcxxabi_thread_t   threads        [ NUMTHREADS ];
+std::__libcpp_thread_t   threads        [ NUMTHREADS ];
 #endif
----------------
EricWF wrote:
> What happened to the initializer?
I don't think it needs one here?

`std::__licpp_thread_create()` does not require `std::__libcpp_thread_t` argument to be statically initialized.


https://reviews.llvm.org/D27575





More information about the cfe-commits mailing list