News for hackers. Stuff that matters.
Re:Thread Safety Analysis in Clang by Matthias247 on Wednesday March 29, 2017 @07:36AM (#13985097)
Looks interesting, especially as a way to introduce some extra thread safety checking into legacy codebases. Or improve the quality of new ones if C++ is the target (yes, I know that Rust can do similar things without extra tools).

If anyone is familiar with it I directly have a question regarding it: An often used pattern besides locking is that data is owned by a particular thread, and only that thread is allowed to mutate the data. E.g. in GUIs only the main thread can mutate it. I guess that can also be expressed with the tool, but examples would be welcome. I guess the owning thread could have the capability, but a challenge could be that the start and end of the owning thread might be encapsulated by a library (e.g. QT or Windows mainloop), and be slightly hidden from the implementation of components. The goal should be that if I do

    field = value;
inside an arbitrary thread I get a warning. And if I do

    owningThreadWithEventLoop.post([](){ field = value; });
everything is fine.

There are no comments on this comment yet.