OxL Справочник OxL
РусскийEnglish

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✓ проверяется в CI
fn main() io, time {
  node.background.spawnDaemon(() => {
    sleep(60s)
  })
  print("main returns; the daemon does not keep the node alive")
}
Вывод
main returns; the daemon does not keep the node alive
pub(api) fn spawnDaemon<effect F>(f: fn() F)

С версии. 1.0.0-beta

Параметры

ИмяТип
ffn() F

Эффекты

не объявлены (чистая, пока тело не говорит иное)

Определено в: std/core/node.oxl:55

См. также