Preprocessor macro expanding to an expression
Space | User/kernel |
Context | Sync/async |
May block | No |
SPL | Any |
Dynamic memory | No |
#include <SPAD/AC.H>
if (SPLX_BUSY(splx)) ...
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.
SPL_X
or by other means (reading KERNEL$SPL
).Returns non-zero if there is an AST or IORQ pending on or above splx.
If the argument is constant, the macro performs a compile-time check for correctness.
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)