summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorRichard Braun <rbraun@sceen.net>2019-01-10 23:27:59 +0100
committerRichard Braun <rbraun@sceen.net>2019-01-10 23:27:59 +0100
commit9b40330cdc9399acb3687cbccb7696b4fd9feb0e (patch)
tree2b350482071be9fec8a0bd667a6df4936a33677a /test
parentb4ab6ce08cf45939e640fdf3f9ba75bef8316320 (diff)
kern/semaphore: rework
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.
Diffstat (limited to 'test')
0 files changed, 0 insertions, 0 deletions