$include_dir="/home/hyper-archives/boost/include"; include("$include_dir/msg-header.inc") ?>
Subject: [boost] [thread] boost::thread and thread safety annotations
From: Wladimir (laanwj_at_[hidden])
Date: 2012-09-26 05:33:20
Hello,
The Clang C++ compiler project is currently working on a thread safety
analyzer.
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:
http://clang.llvm.org/docs/LanguageExtensions.html#threadsafety
It is customary to use these attributes by defining macros, for
compatibility:
http://www.mail-archive.com/linuxkernelnewbies@googlegroups.com/msg01455.html
At one time, it was also supposed to end up in G++, but this was
abandoned in favor of clang (see
http://gcc.gnu.org/wiki/ThreadSafetyAnnotation). 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?
Regards,
Wladimir