Xo is experimental. The source code is not public yet; it will be soon. Read the release notes
Menu · XO1405

Docs

XO1405: blocking operation in a real-time function

error · reported by the checker

A real-time function (core 6.5) may not wait for other tasks or the operating system: channel operations, for over a channel, Mutex.with and with_read, scope, select, spawning and awaiting tasks, dbg, and capability calls are rejected. It may declare no effect besides ffi. Atomic operations do not block and are allowed: share state with the rest of the program through Atomic values, or pass the data in and out as arguments.

Example

fn tick(c: Chan[Float], x: Float) uses realtime {
  c.send(x)
}

Fix

fn tick(level: Atomic[Int], x: Float) uses realtime {
  level.set(Int(x * 1000.0))
}

Run xo explain XO1405 for this text in a terminal, or see section 10.6 of the specification.