4 ms·
Yes, I saw your screenshots, and I think they demonstrate lack of understanding of how condition variables work. Any use of condition variables where the lock
by thraway123412 6y ago
Yes, I saw your screenshots, and I think they demonstrate lack of understanding of how condition variables work.
Any use of condition variables where the lock is "never used" screams fundamentally broken to me. No amount of atomics and memory orderings or manually inserted fences/memory barriers can help you if you leave a race window open between checking your predicate and starting to wait on a signal. Condvar signals are not sticky. If nobody is waiting for a signal when you signal, that signal is lost. There is nothing between your atomics and lock & wait to prevent such loss.
Also your TLA+ (or rather PlusCal) does not model a condition variable correctly, so it would obviously not detect this issue. You have a sticky boolean variable and await, which blocks the procedure until the condition becomes true. This detects lockups of the class where the condition is never signalled at all, but it does not model the possibility of losing a signal because nobody was waiting for it.
I don't believe you discovered a bug in glibc and musl.