[cfe-users] When did Clang provide C++11 mutex?

Csaba Raduly via cfe-users cfe-users at lists.llvm.org
Tue Jun 7 00:33:10 PDT 2016


Hi Jeffrey,

On Mon, Jun 6, 2016 at 12:16 PM, Jeffrey Walton via cfe-users
<cfe-users at lists.llvm.org> wrote:
> I'm having trouble determining feature availability at compile time.
> We don't use Autotools and friends; rather, we use the preprocessor.
>
> I've been through the release notes from 2.8 through 3.5 (form: ), and
> I can't find mention of mutex.
>
> I've also been to the latest docs, and I can't find a
> __has_feature(cxx_mutex) or similar
> (http://clang.llvm.org/docs/LanguageExtensions.html).
>
> Finally, I visited http://clang.llvm.org/cxx_status.htmlbut there is
> no topic or item for mutex. There is a statement "Clang 3.3 and later
> implement all of the ISO C++ 2011 standard", so I guess that's the
> version I should use in the absence of better information.

std::mutex is not a feature of the compiler (clang). It is a feature
of the C++ Standard Library (libcxx).

You should look for the <mutex> header. If the following compiles,
then mutex should be available:

#include <mutex>
std::mutex m;

Csaba
-- 
GCS a+ e++ d- C++ ULS$ L+$ !E- W++ P+++$ w++$ tv+ b++ DI D++ 5++
The Tao of math: The numbers you can count are not the real numbers.
Life is complex, with real and imaginary parts.
"Ok, it boots. Which means it must be bug-free and perfect. " -- Linus Torvalds
"People disagree with me. I just ignore them." -- Linus Torvalds


More information about the cfe-users mailing list