Threading Support API¶
Libc++ supports using multiple different threading models and configurations
to implement the threading parts of libc++, including
These different models provide entirely different interfaces from each
other. To address this libc++ wraps the underlying threading API in a new and
consistent API, which it uses internally to implement threading primitives.
<__threading_support> header is where libc++ defines its internal
threading interface. It contains forward declarations of the internal threading
interface as well as definitions for the interface.
In order to support vendors with custom threading API’s libc++ allows the entire internal threading interface to be provided by an external, vendor provided, header.
_LIBCPP_HAS_THREAD_API_EXTERNAL is defined the
header simply forwards to the
<__external_threading> header (which must exist).
It is expected that the
<__external_threading> header provide the exact
interface normally provided by
libc++ can be compiled with its internal threading API delegating to an external library. Such a configuration is useful for library vendors who wish to distribute a thread-agnostic libc++ library, where the users of the library are expected to provide the implementation of the libc++ internal threading API.
On a production setting, this would be achieved through a custom
<__external_threading> header, which declares the libc++ internal threading
API but leaves out the implementation.
This macro is defined when libc++ is built without threading support. It should not be manually defined by the user.
This macro is defined when libc++ should use the
<__external_threading>header to provide the internal threading API. This macro overrides
This macro is defined when libc++ should use POSIX threads to implement the internal threading API.
This macro is defined when libc++ should use Win32 threads to implement the internal threading API.