[OT] Clang thread safety analysis finds mutex locking bugs in linux kernel

Sebastiaan Koppe mail at skoppe.eu
Sun Feb 9 15:11:06 UTC 2025


On Sunday, 9 February 2025 at 09:23:29 UTC, Richard (Rikki) 
Andrew Cattermole wrote:
> This is something I've been wanting in D for quite a few years 
> now.
>
> Static analysis for mutex locking on variables.
>
> Here is the clang documentation for it: 
> https://clang.llvm.org/docs/ThreadSafetyAnalysis.html
>
> And the article on the Linux use of it: 
> https://www.phoronix.com/news/Linux-Clang-Thread-Safety
>
> I'll continue to explore it after the DFA language features 
> work has been completed. This is currently waiting on some 
> feedback from Walter for a requirements document scope.

In D this can be modeled using shared, a guard and the with 
statement. Invalid use results in a similar compile time error. 
Its not _as_ flexible though, but works quite well in practice.


More information about the Digitalmars-d mailing list