Interface SPLX_BUSY

Preprocessor macro expanding to an expression

SpaceUser/kernel
ContextSync/async
May blockNo
SPLAny
Dynamic memoryNo

#include <SPAD/AC.H>

if (SPLX_BUSY(splx)) ...

Description

This macro tests if there is some event pending on SPL splx or higher. If there is, it returns nonzero. If there isn't, it returns zero.

Arguments

Returns

Returns non-zero if there is an AST or IORQ pending on or above splx.

Implementation note

If the argument is constant, the macro performs a compile-time check for correctness.

Example

To maintain good interrupt latency, there must not be any loop on SPL_TOP. If we need to make a loop there, we must test inside the loop if some interrupt interrupted us and eventually drop the SPL. This is an example how to do it with SPLX_BUSY.

int spl = KERNEL$SPL;
RAISE_SPL(SPL_TOP);
while (condition) {
        ... do something locked
        if (SPLX_BUSY(spl)) {
                ... prepare for unlock
                TEST_SPLX(spl, SPL_X(SPL_TOP));
                ... check after locking
        }
}
LOWER_SPLX(spl)

See also

SPL_X, KERNEL$SPL, TEST_SPL, TEST_SPLX