Orjan Petersson wrote:Anthony,
I understand I can get a C++0X thread library (like yours :-) to start using the new C++ multithreading features with my current compiler.
However, I suppose there are the other C++0X concurrency features for which I need a new version of the compiler. If so, what are those?
The key concurrency feature which cannot be implemented as a library is the
thread_local keyword. My library provides a macro (
JSS_THREAD_LOCAL()) which emulates this facility in some contexts, but it cannot provide a general solution, and requires you to use a macro rather than a keyword.
The use of
constexpr to guarantee static initialization for objects of class type (such as
std::mutex) cannot be emulated either. In some cases the compiler will naturally do the required static initialization as part of normal optimization, but in others it will generate dynamic initialization code to call the relevant constructor.