Blog Archive for / 2012 / 09 /

just::thread C++11 Thread Library V1.8.0 vs Microsoft Visual Studio 2012

Thursday, 06 September 2012

I am pleased to announce that version 1.8.0 of just::thread, our C++11 Thread Library has just been released.

This release adds official support for Microsoft Visual Studio 2012, as well as providing some minor bug fixes and improvements across the board.

Some people have asked how Just::Thread compares to the thread-library support in Microsoft Visual Studio 2012, given that VS2012 now provides the new C++11 concurrency headers, so I ran some of the Just::Thread tests against the VS2012 library. It turns out that there are quite a few places where Just::Thread has better conformance than VS2012, so if you're making heavy use of the C++11 thread library then upgrading to Just::Thread is an essential investment.

VS2012 thread library conformance issues

Here is a list of some of the areas where Just::Thread provides better conformance than VS2012. Some of these can be worked around; others are important for correctly-functioning code. This is just a sample, not a comprehensive list.

  • With the VS2012 library, you cannot use move-only types with std::promise, and std::async doesn't work with functions that return move-only types.
  • With the VS2012 library, std::thread doesn't work with move-only argument types.
  • With the VS2012 library, the wait_for and wait_until functions return incorrect values when used with a std::future that comes from a std::promise.
  • With the VS2012 library, when std::async is used with a launch policy of std::launch::async, the destructor of the returned std::future instance does not wait for the thread to complete.
  • With the VS2012 library, std::unique_lock does not check whether or not it owns the lock before calling operations on the underlying mutex, triggering undefined behaviour rather than throwing an exception in many cases.
  • With the VS2012 library, the std::atomic<> class template cannot be used on types without a default constructor.
  • With the VS2012 library, std::launch and other strongly-typed enums such as std::future_status are emulated with a namespace-scoped enum rather than a strongly-typed enum.

In all these cases (and more), Just::Thread conforms with the standard.

Just::Thread optimizations

Just::Thread also offers various optimizations over the VS2012 thread library such as the following.

  • The return value from a task run with std::async is copied/moved fewer times, and moved where possible.
  • A function object passed to std::thread is copied or moved fewer times.
  • The task passed to std::async is destroyed as soon as the task is completed, even if there are outstanding futures that reference the result.

Again, this is not a comprehensive list. Just::Thread has been carefully optimized to ensure common use cases have the best performance possible whilst remaining conformant to the C++11 standard.

Get your copy of Just::Thread

Purchase your copy and get started with the C++11 thread library now.

As usual, existing customers are entitled to a free upgrade to V1.8.0 from all earlier versions.

Posted by Anthony Williams
[/ news /] permanent link
Tags: , , ,

| Stumble It! stumbleupon logo | Submit to Reddit reddit logo | Submit to DZone dzone logo

Comment on this post

If you liked this post, why not subscribe to the RSS feed RSS feed or Follow me on Twitter? You can also subscribe to this blog by email using the form on the right.

Previous Entries Later Entries