C++ / CONCURRENCY / BTOP
btop's broken lock
Two threads could hold the same lock.
Following a btop crash led me to a lock that could let two threads in at once. From there I traced another race through Runner::active.
- A failed compare-exchange changed expected, allowing the next attempt to pass while another thread held the lock.
- Callers relied on Runner::active to hand off shared state. The waits needed acquire ordering.
- PR #1649 landed the race fixes. The original CPU-hotplug crash remains open.