1. 15
    1. 4

      One interesting thing about FreeBSD’s kernel condition variables, which isn’t mentioned in the discussion here: they don’t use atomics internally. As the article describes, you need to provide a mutex to avoid lost wakes with a condition variable and so the kernel condition variable uses this lock to protect its internal state. The userspace equivalent can’t do this because the POSIX (and C++) spec allows signalling or waiting on a condition variable without holding the lock.