[Openmp-commits] [PATCH] D59451: Fix gettid warnings and one test on FreeBSD

Kamil Rytarowski via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Sun Mar 17 13:48:01 PDT 2019

krytarowski added a comment.

In D59451#1432542 <https://reviews.llvm.org/D59451#1432542>, @dim wrote:

> In D59451#1432417 <https://reviews.llvm.org/D59451#1432417>, @krytarowski wrote:
> > >   it's not with libc++ and newer libstdc++.
> >
> > Some OSs merged libpthread into libc and/or implemented it almost fully in the kernel. It's not the case on NetBSD and apparently FreeBSD.
> >
> > In libc there are just stubs for libpthread to allow linking but without defined interfaces, unless someone will link with the POSIX threading library.
> Indeed, at least on FreeBSD there is a desire to fold the full pthread interface into libc, but it's apparently not very easy to do.  So for now we need `-pthread` or `-lpthread` during linking.
> One other thing that could be done is to link `libc++.so.1` with `-lpthread`, but that would make every consumer of libc++ depend on the threading libraries, even if they never use any of the `std::thread` functionality.  At least in our system version of libc++, we've never linked it with the threading libraries, but maybe it's something we should consider.  @emaste any thoughts?

Even if FreeBSD could merge libc with libpthread, the right thing to do with a threaded c++ code is to pass `-pthread` to build flags on POSIX platforms.

  rOMP OpenMP



More information about the Openmp-commits mailing list