[PATCH] D11781: Refactored pthread usage in libcxx

Ed Schouten via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 10 08:11:17 PDT 2015

ed added a subscriber: ed.

Comment at: include/__config:742
@@ +741,3 @@
+# if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__linux__) || defined(__APPLE__)
espositofulvio wrote:
> theraven wrote:
> > #ifdef unix will catch most of these (for some reason, not OS X, even though it's the only one that actually is certified as UNIX...)
> I didn't know that and I'm not sure I've included all the supported platforms (in include/__config there are definitions for __ sun __ and __ CloudABI __ which I know very little about). Is there somewhere a list of supported platforms?
CloudABI has pthreads, but it does not have `unix` defined. Both FreeBSD and CloudABI also support C11 `<threads.h>`.

If you're going to stick to the code you have right now, be sure to add `defined(__CloudABI__)` to that list of operating systems.

The POSIX way of testing whether pthreads is available is:

    #include <unistd.h>
    #if _POSIX_THREADS > 0

See: http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/unistd.h.html



More information about the cfe-commits mailing list