Thread safety annotations for movable lock guards

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

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.
:frowning: There are plans to combine the two, but we're probably looking at
an end-of-year time frame.

  -DeLesley

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.
:frowning: 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