OxL Reference

data NodeBackground

The background scope of the node (§8.5): tasks that live as long as the node, not as long as a scope.

Example:

oxl✓ checked in CI
// a node with a live background task does not exit after `main`: it runs until SIGTERM
fn main() io, time {
  node.background.spawn(() => {
    sleep(10ms)
  })
}
@derive(Copy)
pub(api) data NodeBackground

Thread safety. safe to call from any task.

Since. 1.0.0-beta

Methods

spawn(f: fn() F)
Starts f as a background task of the node.
spawnDaemon(f: fn() F)
Like spawn, but the task never keeps the node alive

Defined in: std/core/node.oxl:17

See also