[cfe-dev] Thread safety annotations for movable lock guards

Stephan Tolksdorf st at quanttec.com
Tue May 6 11:04:41 PDT 2014


Delesley Hutchins wrote:
> We currently have two analyses in clang.  Thread safety analysis knows
> about locks, and consumed analysis knows about movable types, like
> unique_ptr.  Unfortunately, they don't talk to each other right now.
> :-(  There are plans to combine the two, but we're probably looking at
> an end-of-year time frame.

Thanks for the info! Good to know that this is on your radar.

Can you maybe think of some hackish way to make move constructors and 
factory functions of lock guards work with the existing annotation 
system, e.g. by pretending to unlock and relock the mutex or similar 
trickery?

- Stephan

>
>
> On Tue, May 6, 2014 at 10:30 AM, Stephan Tolksdorf <st at quanttec.com> wrote:
>> Hi,
>>
>> Is there a way to make clang's thread safety annotations work with movable
>> lock guards (i.e. RAII classes for locking a mutex), like e.g.
>> std::unique_lock? How should the move constructor of such a lock guard be
>> annotated, or a factory function returning a guard?
>>
>> If this is currently not supported, are there maybe any plans to support it
>> in the future?
>>
>> Thanks in advance for any hint!
>>
>> Best regards,
>>    Stephan
>
>
>



More information about the cfe-dev mailing list