KSEMAPHORE(9) | Kernel Developer's Manual | KSEMAPHORE(9) |
ksemaphore
,
ke_semaphore_init
,
ke_semaphore_reset
,
ke_semaphore_release
,
ke_semaphore_release_maxone
—
dispatcher mutex object
#include
<kdk/kern.h>
void
ke_semaphore_init
(ksemaphore_t
*sem, unsigned
count);
void
ke_semaphore_reset
(ksemaphore_t
*sem, unsigned
count);
void
ke_semaphore_release
(ksemaphore_t
*sem, unsigned
adjustment);
void
ke_semaphore_release_maxone
(ksemaphore_t
*sem);
The semaphore object is a counter that can be incremented and decremented. When the counter is zero, waiters will be put to sleep until the counter is incremented.
Waiters sleep until the counter is positive, and the counter is decremented when a waiter is satisfied.
The
ke_semaphore_init
()
function initialises a semaphore object, setting its counter to the value
specified by the count parameter.
The
ke_semaphore_reset
()
function resets a semaphore object, setting its counter to the value
specified by the count parameter.
The
ke_semaphore_release
()
function increments the counter of a semaphore object by the value specified
by the adjustment parameter.
The
ke_semaphore_release_maxone
()
function increments the counter of a semaphore object by one only if the
counter was zero.
All these functions may be called from any context at or below
kIPLDPC
.
These functions are implemented in kernel/kern/semaphore.c.
The interface is declared in kernel/include/kdk/kern.h.
These interfaces have always been in Keyronex.
October 6, 2024 | Debian |