summaryrefslogtreecommitdiff
path: root/kern/semaphore.h
AgeCommit message (Collapse)Author
2019-01-17Replace "awaken" with "awoken"Richard Braun
See https://www.merriam-webster.com/words-at-play/usage-awaken-awoken-awakened.
2019-01-10kern/semaphore: reworkRichard Braun
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.
2018-02-24New errno.h standard headerRichard Braun
Use standard errno codes. This change also adds strerror to string.h.
2018-02-24Don't use reserved identifiersRichard Braun
2017-09-22kern/semaphore: improve descriptionRichard Braun
Replace the POSIX terminology of "locking" and "unlocking" with "waiting" and "signalling". In addition, discourage the use of semaphores.
2017-09-07kern/semaphore: do not assume common caseRichard Braun
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.
2017-08-27kern/semaphore: implement timed waitsRichard Braun
2017-05-30Move assert.h to the include directoryRichard Braun
This turns assert.h into a standard header.
2017-05-29kern/semaphore: replace xxx_once macros with atomic accessorsRichard Braun
2017-04-10kern/semaphore: optimize for binary semaphoresRichard Braun
2017-03-17kern/semaphore: allow unlocking from interrupt contextRichard Braun
2017-03-17kern/semaphore: new moduleRichard Braun