News for hackers. Stuff that matters.
Re:Thread Safety Analysis in Clang by hellofunk on Wednesday March 29, 2017 @05:40PM (#13990849)
That does not solve the issue of locks, just abstracts the mechanisms away (hence why std::atomic has member functions related to checking for locks).

The OP is correct, these tools are generally frowned upon in favor of better strategies.

Re:Thread Safety Analysis in Clang by flamedoge on Wednesday March 29, 2017 @07:29PM (#13991579)
It offers finer grain control than simple mutexes. One can write lock-free data structure easily with it.
Re:Thread Safety Analysis in Clang by hellofunk on Thursday March 30, 2017 @05:02AM (#13993891)
The very fact that atomics do lock means that you cannot properly write lock-free data structures with them.

"Lock free" typically refers to code that can prevent blocking operations; atomics do not do that, though some people think of atomics as a simple lock-free method, it really isn't. Lock-free is about algorithm design that can prevent locking in the first place, and atomics still lock, even if they hide that from you. If you mentioned atomics as a lock-free tool in an interview, you'd likely be chided.

Here is more information:

http://preshing.com/20120612/an-introduction-to-lock-free-pr...

"when you attempt to satisfy the non-blocking condition of lock-free programming, a whole family of techniques fall out: atomic operations"

Re:Thread Safety Analysis in Clang by flamedoge on Thursday March 30, 2017 @12:50PM (#13996965)
lol... do you have a solution then without using any atomic operations to write a lock-free data structure? Please. give me an example that works.
Re:Thread Safety Analysis in Clang by hellofunk on Thursday March 30, 2017 @01:42PM (#13997356)
I don't need to come up with a solution, because there are already so many in the literature.