-
Notifications
You must be signed in to change notification settings - Fork 646
Things You Should Know
(Timer callbacks happen from IRQ context)
A number of these functions take a 'reschedule' parameter, which must
be false when called from IRQ context. If your interrupt handler takes
action which will wake a thread and you want to ensure it wakes now
(provided priority is high enough) rather than when the next quantum
expires, return INT_RESCHEDULE
instead of INT_NO_RESCHEDULE
. This
will cause the kernel to invoke the scheduler before returning to
thread context.
The follow actions are IRQ-safe:
-
Wake threads on wait queues with
wake_queue_wake_one()
orwake_queue_wake_all()
. -
Signal an event with
event_signal()
. -
Reprogram a timer with
timer_set_oneshot()
,timer_set_periodic()
, ortimer_cancel()
. -
Timer reprogramming is safe even from within that timer’s callback.
-
Use spinlocks (but usually the higher level primitives are what you want).
This unsigned type is used by kernel functions involving timers,
timeouts, etc, and is in units of milliseconds. The maximum value
(defined as INFINITE_TIME
) is used to specify a timeout that will
never expore. The value 0 passed as a timeout parameter always means ``return immediately if you would have to wait.''
ERR_TIMED_OUT
is the status returned by a function taking a timeout
value, if the timeout expires before the requested action can be
accomplished.