# stdlib: fix condition variable broadcast FutexImpl · gitcafe/zig

[View on GitCafe](https://git.cafe/gitcafe/zig/commit/f229b740999b58432dc49e3aa412fac14e3781f3)

Repository: [gitcafe/zig](https://git.cafe/gitcafe/zig)

Visibility: public

Requested revision: f229b740999b58432dc49e3aa412fac14e3781f3

Requested commit: f229b740999b58432dc49e3aa412fac14e3781f3

Commit: f229b740999b58432dc49e3aa412fac14e3781f3

Tree: 5d457a6c2468723a9be5102ea6567f9cecc7e0b5

Author: Igor Anić

Committer: Igor Anić

## Message

```
stdlib: fix condition variable broadcast FutexImpl

fixes #12877

Current implementation (before this fix) observes number of waiters when
broadcast occurs and then makes that number of wakeups.

If we have multiple threads waiting for wakeup which immediately go into
wait if wakeup is not for that thread (as described in the issue). The
same thread can get multiple wakeups while some got none.
That is not consistent with documented behavior for condition variable
broadcast: `Unblocks all threads currently blocked in a call to wait()
or timedWait() with a given Mutex.`.

This fix ensures that the thread waiting on futext is woken up on futex wake.

```

## Parents

- [88a0f3d0e55691aa2b341cfa6efc53f2540b22f9](https://git.cafe/gitcafe/zig/commit/88a0f3d0e55691aa2b341cfa6efc53f2540b22f9?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zig/tree/f229b740999b58432dc49e3aa412fac14e3781f3?format=markdown)
