Skip to content

Design choice question #974

Description

@davidbrochart

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions