If I understand correctly, in Effection child tasks cannot outlive their parent but their lifetime doesn't really affect their parent. For instance:
import { run, sleep, spawn } from "@effection/effection";
run(function* op() {
let task1 = yield* spawn(() => sleep(1000));
let task2 = yield* spawn(() => sleep(2000));
// yield* task1;
// yield* task2;
console.log('done');
});
Will print done immediatly.
This is different than Trio, where all tasks in a nursery (or task group) must finish before the nursery's context manager exits.
Maybe I am missing something, but otherwise I was wondering about the reasons behind this design choice.
If I understand correctly, in Effection child tasks cannot outlive their parent but their lifetime doesn't really affect their parent. For instance:
Will print
doneimmediatly.This is different than Trio, where all tasks in a nursery (or task group) must finish before the nursery's context manager exits.
Maybe I am missing something, but otherwise I was wondering about the reasons behind this design choice.