KE_WAIT(9) | Kernel Developer's Manual | KE_WAIT(9) |
ke_wait
,
ke_wait_multi
— dispatcher
object waiting mechanism
#include
<kdk/kern.h>
kwaitstatus_t
ke_wait
(void
*object, const char
*reason, bool user,
bool alertable,
nanosecs_t timeout);
kwaitstatus_t
ke_wait_multi
(size_t
nobjects, void
*objects[], const char
*reason, bool
wait_all, bool
user, bool
alertable, nanosecs_t
timeout, kwaitblock_t
*waitblocks);
Acquisition may have side effects depending on which object is being waited on; for example, when a wait for a mutex is satisfied, the mutex is then owned by the waiting thread.
The
ke_wait
()
function waits on a single dispatcher object, while the
ke_wait_multi
()
function waits on multiple dispatcher objects - either until all of them
bcome signalled and all acquired, or until any one of them becomes signalled
and is acquired.
If none of the objects is signalled or (for wait-all) all of the objects are not signalled at the time of calling the wait function, the waiting thread is put to sleep until such time as the object(s) become signalled and the wait can be satisfied.
The object types that can be waited on are as follows:
The parameter object or objects specifies the object(s) to wait on.
The parameter reason specifies a string that describes the reason for waiting, for debugging purposes.
The parameter wait_all specifies whether the wait should be satisfied only when all objects are signalled and acquired. Otherwise, the wait is satisfied when any one of the objects is signalled and acquired.
The parameter user specifies whether the wait is being performed on behalf of a user thread.
The parameter alertable specifies whether the wait can be interrupted by an alert, signal, or AST.
The parameter timeout specifies the maximum time to wait for the object(s) to become signalled, in nanoseconds, before returning unsatisfied.
For waits on greater than 4 objects, the parameter waitblocks should point to an array of wait blocks, one for each object being waited on. These do not need to be initialised.
These functions may only be called from thread context at
ipl(9) less than
kIPLDPC
.
On success, the index of the object that was signalled is
returned. For ke_wait
(), which takes only one
argument, this is always 0.
Otherwise, a negative code is returned. These codes are:
kKernWaitStatusTimedOut
kKernWaitStatusSignalled
kKernWaitStatusInvalidArgument
These functions are implemented in kernel/kern/wait.c.
The interface is declared in kernel/include/kdk/kern.h.
These interfaces have always been in Keyronex.
October 6, 2024 | Debian |