isInDelay

abstract fun isInDelay(name: String): Boolean(source)

True when this process is currently in a delay with the given suspension name, so that the delay can be interrupted. False when the process is in a delay with another name, is waiting for something other than a delay, is moving, has not started, or has ended.

Interrupting a process that is not in the named delay is an error, so a process that may interrupt another at a time when the target is not delaying checks first:

if (machine.script.isInDelay("work")) {
      interruptDelayAndContinue(machine.script, "work", repairTime)
} else {
      delay(repairTime)   // the machine was idle: down for the repair anyway
}

Return

true if the process is in that delay

Parameters

name

the suspension name of the delay