Boost logo

Boost :

Subject: [boost] [thread] boost::thread and thread safety annotations
From: Wladimir (laanwj_at_[hidden])
Date: 2012-09-26 05:33:20


The Clang C++ compiler project is currently working on a thread safety

By making use of so-called thread safety annotations within the source
code, several problems with synchronization primitives can be found
statically. For example: usage of a data structure without acquiring its
guarding lock.

See here for an overview of the available attributes:

It is customary to use these attributes by defining macros, for

At one time, it was also supposed to end up in G++, but this was
abandoned in favor of clang (see But at least the
annotations are fairly standardized.

I think it would be useful to add these annotations to boost::thread, so
that projects using that library can make use of the static checking.

As I understand it, is only a matter of marking data structures that
serve as lock/scoped_lock (such as boost::mutex, boost::recursive_mutex,
...), and methods that act upon the lock with the appropriate attributes.

Any interest in this?


Boost list run by bdawes at, gregod at, cpdaniel at, john at