Blog Archive for / news /
Enforcing Correct Mutex Usage with Synchronized Values
Friday, 28 May 2010
My latest article, Enforcing Correct Mutex Usage with Synchronized Values has been published on the Dr Dobb's website.
This article expands on the SynchronizedValue<T>
template I mentioned in my presentation
on Concurrency
in the Real World at ACCU 2010, and deals with the problem of
ensuring that the mutex associated with some data is locked whenever
the data is accessed.
The basic idea is that you
use SynchronizedValue<T> wherever you have
an object of type T that you wish to be protected with
its own mutex. The SynchronizedValue<T> then
behaves like a pointer-to-T for simple uses.
Read the article for the full details.
Posted by Anthony Williams
[/ news /] permanent link
Tags: mutex, cplusplus
Stumble It!
| Submit to Reddit
| Submit to DZone ![]()
If you liked this post, why not subscribe to the RSS feed
or Follow me on Twitter? You can also subscribe to this blog by email using the form on the right.
just::thread C++0x Thread Library V1.4 (FCD Edition) Released
Thursday, 06 May 2010
I am pleased to announce that version 1.4 (the FCD edition)
of just::thread,
our C++0x Thread Library
has just been released.
With the release of the "FCD edition", just::thread
provides the first complete implementation of the multithreading
facilities from
the Final
Committee Draft (FCD) of the C++0x standard.
Changes include:
- New
promise::set_value_at_thread_exit,promise::set_exception_at_thread_exit, andpackaged_task::make_ready_at_thread_exitmember functions to defer unblocking waiting threads until the notifying thread exits -
New
notify_all_at_thread_exit functionfor notifying condition variables when the notifying thread exits -
The
wait_forandwait_untilmember functions offuture,shared_futureandatomic_futurereturn afuture_statusenum rather thanboolto indicate whether the future is ready, the wait timed out, or the future contains a deferred async function - The destructor of the last future associated with an async function waits for that function to complete.
- New
ATOMIC_VAR_INITmacro for initializing atomic objects - The callable object for a
packaged_taskis destroyed with thepackaged_taskrather than being kept alive until the future is destroyed
As usual, existing customers are entitled to a free upgrade to V1.4.0 from all earlier versions.
Posted by Anthony Williams
[/ news /] permanent link
Tags: multithreading, concurrency, C++0x
Stumble It!
| Submit to Reddit
| Submit to DZone ![]()
If you liked this post, why not subscribe to the RSS feed
or Follow me on Twitter? You can also subscribe to this blog by email using the form on the right.
"Concurrency in the Real World" slides now available
Monday, 19 April 2010
The slides for my presentation on "Concurrency in the Real World" at the ACCU 2010 conference last week are now available.
The room was full, and quite warm due to the air conditioning having been turned off, but everything went to plan, and there were some insightful questions from the audience. I've thoroughly enjoyed presenting at ACCU in previous years, and this was no exception.
I covered the main pitfalls people encounter when writing multithreaded code, along with some techniques that I've found help deal with those problems, including some example code from projects I've worked on. As you might expect, all my examples were in C++, though the basic ideas are cross-language. I finished up by talking about what we might hope to get out of multithreaded code, such as performance, additional features and responsiveness.
There's a discount on
my just::thread
library until Friday 23rd April 2010, so if you're doing concurrency
in C++ with Microsoft Visual Studio on Windows or g++ on linux get
yourself a copy whilst it's on offer and start taking advantage of
the new
C++0x thread
library.
Posted by Anthony Williams
[/ news /] permanent link
Tags: concurrency, multithreading, c++, ACCU
Stumble It!
| Submit to Reddit
| Submit to DZone ![]()
If you liked this post, why not subscribe to the RSS feed
or Follow me on Twitter? You can also subscribe to this blog by email using the form on the right.
Sign up for a 50% discount just::thread FCD edition
Wednesday, 07 April 2010
I'm in the process of updating our C++0x thread library for VS2008, VC10, g++ 4.3 and g++ 4.4 to incorporate the changes to the C++0x thread library voted into the C++0x FCD. I'll be writing a blog post with more details in due course, but the big changes are:
- Functions for postponing notification of threads waiting on a
std::futureuntil the thread that set the value on thestd::promiseor ran thestd::packaged_taskhas exited. - A similar facility for notifying
a
std::condition_variableat thread exit. - Defined behaviour for
the
wait_for()andwait_until()member functions ofstd::futurewhen used withstd::asyncand a launch policy ofstd::launch::sync. - Changes to the initialization of atomic variables.
Existing customers will get the new version as a free upgrade, but
the rest of you can get a 50% discount if you subscribe to
my blog by email. Just fill in your name and email address
in the form below and be sure to click the confirmation link. You'll
then receive future blog posts by email, along with an announcement
and exclusive discount for the FCD edition
of just::thread
when it's released.
If you're reading this via RSS and your reader doesn't show you the form or doesn't allow you to submit your details, then please go to the web version of this blog entry.
If you've already subscribed by email then you don't need to subscribe again, you'll automatically receive the discount code.
Posted by Anthony Williams
[/ news /] permanent link
Tags: concurrency, threading, C++0x, just::thread
Stumble It!
| Submit to Reddit
| Submit to DZone ![]()
If you liked this post, why not subscribe to the RSS feed
or Follow me on Twitter? You can also subscribe to this blog by email using the form on the right.
just::thread C++0x Thread Library V1.3.2 Released
Thursday, 25 March 2010
I am pleased to announce that version 1.3.2 of just::thread, our C++0x Thread Library has just been released.
This release is the first to feature support for the Microsoft Visual Studio 2010 RC for both 32-bit and 64-bit Windows.
There are also a few minor fixes to the future classes, and a new implementation of mutexes and condition variables on linux with lower overhead.
Purchase your copy and get started with the C++0x thread library NOW.As usual, existing customers are entitled to a free upgrade to V1.3.2 from all earlier versions.
Posted by Anthony Williams
[/ news /] permanent link
Tags: multithreading, concurrency, C++0x
Stumble It!
| Submit to Reddit
| Submit to DZone ![]()
If you liked this post, why not subscribe to the RSS feed
or Follow me on Twitter? You can also subscribe to this blog by email using the form on the right.
just::thread C++0x Thread Library V1.3 Released
Wednesday, 13 January 2010
I am pleased to announce that version 1.3 of just::thread, our C++0x Thread Library has just been released.
This release is the first to feature support for the new std::async
function for starting asynchronous tasks. This provides a higher-level
interface for managing threads than is available with std::thread,
and allows your code to easily take advantage of the available
hardware concurrency without excessive oversubscription.
This is also the first release to support 64-bit Windows.
The linux port is available for 32-bit and 64-bit Ubuntu linux, and takes full advantage of the C++0x support available from g++ 4.3 and g++ 4.4. The Windows port is available for Microsoft Visual Studio 2008 for both 32-bit and 64-bit Windows. Purchase your copy and get started NOW.
As usual, existing customers are entitled to a free upgrade to V1.3 from all earlier versions.
Posted by Anthony Williams
[/ news /] permanent link
Tags: multithreading, concurrency, C++0x
Stumble It!
| Submit to Reddit
| Submit to DZone ![]()
If you liked this post, why not subscribe to the RSS feed
or Follow me on Twitter? You can also subscribe to this blog by email using the form on the right.
Happy New Year 2010
Tuesday, 05 January 2010
It's already five days into 2010, but I'd like to wish you all a Happy New Year!
2009 was a good year for me. Back in January 2009, my
implementation of the C++0x
thread library went on sale, and sales have been growing
steadily since — there's a new version due out any day now,
with support for the new std::async functions and
64-bit Windows. I
also presented
at the ACCU conference for the second year running and
completed the first draft
of my book.
It's also been a big year for the C++ community. The biggest change
is of course
that "Concepts"
were taken out of the C++0x draft since they were not ready. On
the concurrency front,
the proposal
for the new std::async functions
was accepted,
std::unique_future was renamed to
just std::future and the destructor
of std::thread was changed to
call std::terminate rather than detach if
the thread has not been joined or detached.
Popular articles
As is my custom, here's a list of the 10 most popular articles and blog entries from the Just Software Solutions website in 2009. The key difference from last year's list is the rise of the C++0x thread library stuff.
- Implementing
a Thread-Safe Queue using Condition Variables
A description of the issues around writing a thread-safe queue, with code. - Implementing
drop-down menus in pure CSS (no JavaScript)
How to implement drop-down menus in CSS in a cross-browser fashion (with a teensy bit of JavaScript for IE). - Deadlock
Detection with just::thread
This article describes how to use the special deadlock-detection mode of ourjust::threadC++0x thread library to locate the cause of deadlocks. - 10
Years of Programming with POSIX Threads
A review of "Programming with POSIX Threads" by David Butenhof, 10 years after publication. - just::thread
C++0x Thread Library V1.0 Released
This is the release announcement for ourjust::threadC++0x thread library. - Importing
an Existing Windows XP Installation into VirtualBox
This article describes how I recovered the hard disk of a dead laptop to run as a VM under VirtualBox. - Thread
Interruption in the Boost Thread Library
A description of the thread interruption feature of the Boost Thread library. - October
2008 C++ Standards Committee Mailing - New C++0x Working Paper, More
Concurrency Papers Approved
My summary of the October 2008 C++ committee mailing featuring the first feature-complete draft of the C++0x standard. - Multithreading
in C++0x part 1: Starting Threads
This is the first part of my series on the new C++0x thread library. Links to the remaining parts are at the end of the article. - Rvalue
References and Perfect Forwarding in C++0x
An introduction to the new rvalue reference feature of C++0x.
What's coming in 2010?
Will 2010 be even better than 2009? I hope so. There's a new
version
of just::thread
coming soon, and there's another ballot on the C++0x working draft
due in the spring. I'll also be presenting
at ACCU 2010 in April.
What are you looking forward to in 2010?
Posted by Anthony Williams
[/ news /] permanent link
Tags: popular, articles
Stumble It!
| Submit to Reddit
| Submit to DZone ![]()
If you liked this post, why not subscribe to the RSS feed
or Follow me on Twitter? You can also subscribe to this blog by email using the form on the right.
More Chances to Win a copy of just::thread in our Halloween Contest
Thursday, 29 October 2009
It's been good to see the entries coming in for our Halloween Contest, and with only two days to go we've decided to add more chances of winning. A blog post with your concurrency story now counts as TWO entries. You can get a further entry by commenting on this blog entry, and yet another by tweeting about this contest. If you do everything, that gives you four chances to win!
Not only does just::thread provide a complete
implementation of
the C++0x standard
thread library for Windows and Linux, but it also
includes
a special
deadlock detection mode. If deadlocks are sucking the
life out of your multithreaded code then the deadlock detection
mode can get straight to the heart of the problem and tell you
which synchronization objects are the cause of the problem, which
threads are waiting and where. Crucially, the library will also
tell you which thread owns each object, and where it took
ownership.
Good luck!
Posted by Anthony Williams
[/ news /] permanent link
Stumble It!
| Submit to Reddit
| Submit to DZone ![]()
If you liked this post, why not subscribe to the RSS feed
or Follow me on Twitter? You can also subscribe to this blog by email using the form on the right.
Win a copy of just::thread in our Halloween Contest
Friday, 16 October 2009
Yes, that's right — this Halloween we've got 3 copies of
the just::thread
portability pack worth £100 to give away. The
Portability Pack provides implementations
of just::thread
for both Linux and Windows, so you can use the same code for both
platforms right off the bat.
Not only does just::thread provide a complete
implementation of
the C++0x standard
thread library for Windows and Linux, but it also
includes
a special
deadlock detection mode. If deadlocks are sucking the
life out of your multithreaded code then the deadlock detection
mode can get straight to the heart of the problem and tell you
which synchronization objects are the cause of the problem, which
threads are waiting and where. Crucially, the library will also
tell you which thread owns each object, and where it took
ownership.
Enter this contest now for your chance to win.
How to enter
Entering is really easy — just write a short blog post about
your concurrency gremlins that links back to the contest page. It
could be that you'd like to add multithreading to your application
but don't know where to start, or you're plagued with deadlocks (in
which case you could use your new copy
of just::thread
to help you find the cause!) Maybe you've conquered all your
concurrency problems, in which case I'd like to hear about how you
did it. Whatever your story, I want to know —
even a twitter-style 140-character summary would be fine.
Once you've got your blog post up, either email contest@stdthread.co.uk, or add a comment to this blog entry. Just make sure you do it before the deadline: Halloween, 31st October 2009. For full details and terms and conditions, see the contest page.
Good luck!
Posted by Anthony Williams
[/ news /] permanent link
Stumble It!
| Submit to Reddit
| Submit to DZone ![]()
If you liked this post, why not subscribe to the RSS feed
or Follow me on Twitter? You can also subscribe to this blog by email using the form on the right.
"The Perils of Data Races" Article Online
Friday, 11 September 2009
My latest article, Avoiding the Perils of C++0x Data Races has been published at devx.com.
Race conditions are one of the biggest causes of problems in multithreaded code. This article takes a brief look at some of the ways in which race conditions can occur, with sample code that demonstrates the perils of data races.
A Data Race is a specific type of race condition, and occurs where multiple threads access the same non-atomic variable without synchronization, and at least one of those threads performs a write. The sample code in the article demonstrates how a data race can cause corrupt data, which can then cause additional problems in other code.
Posted by Anthony Williams
[/ news /] permanent link
Tags: article, multithreading, C++0x, data races, race conditions
Stumble It!
| Submit to Reddit
| Submit to DZone ![]()
If you liked this post, why not subscribe to the RSS feed
or Follow me on Twitter? You can also subscribe to this blog by email using the form on the right.