Subject: Re: [boost] [thread] boost::thread and thread safety annotations
From: Vicente J. Botet Escriba (vicente.botet_at_[hidden])
Date: 2013-03-04 17:09:25


Le 26/09/12 11:33, Wladimir a écrit :
> 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?
>
>
Hi,

yes why not. Do you have some examples where these annotations could be
used on BoostThread?

Best,
Vicente