Win32 vlc_cond_broadcast is wrong
vlc_cond_broadcast() is supposed to wake up all threads currently waiting on the condition variable. However as of version 2.2.0-git-3237-g52894f2f, it merely wakes up as many threads as are currently waiting. So far instance, this failure mode is possible:
- Say we have three threads: A, B, C.
- Both A and B are waiting on the condition variable.
- C calls vlc_cond_broadcast().
- A is woken up, takes the lock, does stuff.
- A goes back to waiting on the condition variable (thus releasing the lock).
- A is woken up immediately, takes the lock.
- B never wakes up. Instead of waking A once and B once, it wakes up A twice.
Before 2.2.0-git-3237-g52894f2f, the implementation was yet worst. It only ensured that one thread was woken up, possibly but not necessarily more.