OxL Reference

method NodeBackground.spawnDaemon

Like spawn, but the task never keeps the node alive: it is cancelled when main returns (runtime helpers such as the server of a dynamic config, D-5197).

Example:

oxl✓ checked in CI
fn main() io, time {
  node.background.spawnDaemon(() => {
    sleep(60s)
  })
  print("main returns; the daemon does not keep the node alive")
}
Output
main returns; the daemon does not keep the node alive
pub(api) fn spawnDaemon<effect F>(f: fn() F)

Since. 1.0.0-beta

Parameters

NameType
ffn() F

Effects

none declared (pure unless the body says otherwise)

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

See also