[libcxx-commits] [libcxx] [llvm] [libc++] Refactor the configuration macros to being always defined (PR #112094)

Martin Storsjö via libcxx-commits libcxx-commits at lists.llvm.org
Thu Nov 7 01:59:31 PST 2024


mstorsjo wrote:

> @mstorsjo I think the problem is that your if condition isn't dependent. I think something like this would fix it:
> 
> ```c++
> template <class Thread>
> void maybe_set_thread_name(Thread& t, std::string const& name) {
>   if constexpr (std::is_same_v<typename Thread::native_handle_type, ::pthread_t>) {
>     (void)pthread_setname_np(t.native_handle(), name.c_str());
>   }
> }
> ```
> 
> This might be worth trying out.

Thanks! With that form, I did manage to seemingly get it to work.

I've posted such a solution for future reference, but I think we'll steer clear of that for practical reasons for now. But if we want to go down that route - we now have a proper solution. Thanks!

https://github.com/llvm/llvm-project/pull/112094


More information about the libcxx-commits mailing list