Thread Role Analysis
The goal of our thread role analysis research is to enable developers to state intended thread usage policy using simple source code annotations and apply sound compile-time static analysis to check the consistency of the policy with the as-written code.
Developers frequently fail to comply with thread-related preconditions by failing to identify thread roles, determine which code may be executed by each thread role, and ensure that every method executes on threads with the correct role. In addition, preconditions contained in thread usage policies can be hard to identify, poorly documented, incorrectly expressed, out of date, and difficult to find. Finally, there is a general lack of analysis to determine whether code complies with applicable thread usage policies.
This analysis has been partially implemented in Clang as part of the thread safety analysis functionality and has been deployed on a large scale at Google, where it has gained widespread adoption.