espositofulvio added inline comments. ================ Comment at: include/__config:742 @@ +741,3 @@ +#ifndef _LIBCPP_HAS_NO_THREADS +# if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__linux__) || defined(__APPLE__) +# define _LIBCPP_THREAD_API _LIBCPP_PTHREAD ---------------- ed wrote: > 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 > ... > #endif > > See: http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/unistd.h.html Unfortunately I think the POSIX way would fail on any system that hasn't unistd.h (Windows), so I think I'll stick with the list and add the missing ones.
================ Comment at: include/__config:742 @@ +741,3 @@ +#ifndef _LIBCPP_HAS_NO_THREADS +# if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__linux__) || defined(__APPLE__) +# define _LIBCPP_THREAD_API _LIBCPP_PTHREAD ---------------- espositofulvio wrote: > ed wrote: > > 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 > > ... > > #endif > > > > See: http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/unistd.h.html > Unfortunately I think the POSIX way would fail on any system that hasn't > unistd.h (Windows), so I think I'll stick with the list and add the missing > ones. It looks like unix is not defined on Linux, but it has __unix. I think it's safer to stick to the list. Repository: rL LLVM http://reviews.llvm.org/D11781 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits