[libcxx-commits] [libcxx] [libcxxabi] [llvm] [libc++] Implement library support for MCF thread model (PR #116550)
LIU Hao via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Nov 28 17:37:51 PST 2024
lhmouse wrote:
> In other words, the code is pulled in from elsewhere (presumably https://github.com/lhmouse/mcfgthread/blob/master/mcfgthread/libcxx.h), and it's assumed to be available.
This is correct.
> Instead, I would expect the libc++ entry points to be defined _in libc++_ itself, and then for these functions to call into the MCF runtime as needed. What would you think of that approach instead? The reason why this is fairly important is that we normally don't include random "external" headers from libc++ (with the exception of `__external_threading`, which should be redesigned). This also means that libc++ isn't self-sufficient anymore -- it needs to pull in a header from another project in order to build in that configuration, which also means that we can't officially test (hence officially support) this configuration.
Indeed, for GCC and libstdc++ it's an external library. However winpthreads is also not a system library. If, by definition, 'anything that exists in mingw-w64' is not an external library, I can try committing a replica into mingw-w64-libraries. This was mentioned some years ago but it has not been done.
Another option is below:
> For all these reasons, I think it would be better if the libc++-specific API were contained inside libc++, and libc++ only called into MCF entry points defined in the appropriate DLL. To use this configuration, it would then be sufficient to
>
> 1. Install the MCF runtime
> 2. Build libc++ with `LIBCXX_HAS_MCF_THREAD_API=ON`
>
> I'd also like to remind that contributions must be under the Apache license with the LLVM exception, so this must be kept in mind in case the libc++-specific part of the API is contributed here.
It looks to me that another option is to copy 'mcfgthread/libcxx.h' into libc++..? Not sure whether I got your idea.
All headers from mcfgthread are public domain and can be freely copied. (Trivia: Previously they were declared as public domain. However it's kinda self-contradiction that the license applies to something it does not apply or vice versa. The new license says it applies to headers but headers can be used in public domain instead.)
https://github.com/llvm/llvm-project/pull/116550
More information about the libcxx-commits
mailing list