# Add \`timedWait\` to \`std.Thread.Semaphore\` \(\#18805\) · gitcafe/zig

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

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

Visibility: public

Requested revision: 8addf53fb5046a65c6fd0c0d2e7894be60468132

Requested commit: 8addf53fb5046a65c6fd0c0d2e7894be60468132

Commit: 8addf53fb5046a65c6fd0c0d2e7894be60468132

Tree: 189044c1a1adb79047ff8bdb892193ebd78f2778

Author: Felix Kollmann

Committer: GitHub

## Message

```
Add `timedWait` to `std.Thread.Semaphore` (#18805)

* Add `timedWait` to `std.Thread.Semaphore`

Add example to documentation of `std.Thread.Semaphore`

* Add unit test for thread semaphore timed wait

Fix missing try

* Change unit test to be simpler

* Change `timedWait()` to keep a deadline

* Change `timedWait()` to return earlier in some scenarios

* Change `timedWait()` to keep a deadline (based on std.Timer)

(similar to std.Thread.Futex)

---------

Co-authored-by: protty <45520026+kprotty@users.noreply.github.com>
```

## Parents

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

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