Age | Commit message (Collapse) | Author |
|
See https://www.merriam-webster.com/words-at-play/usage-awaken-awoken-awakened.
|
|
The previous implementation, which uses a combination of fast and slow
paths around accessing an atomic integer, suffers from a bug triggered
when two or more posts are performed back-to-back, without a waiter
decrementing the semaphore value in between. The first post would be
the only one signalling a waiter.
In addition, having a fast path that expects the absence of waiters
probably doesn't make sense, as semaphores are expected to be used for
signalling threads. As a result, it was decided to remove the fast path
altogether, and protect the semaphore value with sleep queues.
Finally, as part of the rework, semaphores now have a user-defined maximum
value, in order to make the implementation of, e.g. wrappers for binary
semaphores, convenient.
Thanks to Simon Venken for reporting the bug.
|
|
Use standard errno codes. This change also adds strerror to string.h.
|
|
|
|
Replace the POSIX terminology of "locking" and "unlocking" with "waiting"
and "signalling". In addition, discourage the use of semaphores.
|
|
Unlike locks, which are expected to be used with the goal of minimum
contention in mind, semaphores usage is more vague and it's not reasonable
to expect a common case where they're unlocked.
|
|
|
|
This turns assert.h into a standard header.
|
|
|
|
|
|
|
|
|