Skip to content

Provide a way to tell if an isolate has no more work to do #23609

Closed
@nex3

Description

@nex3

Isolate.addOnExitListener allows the owner of an isolate to listen for that isolate terminating. However, this notion of termination doesn't match the notion the VM uses to determine when a Dart application should exit. When running an application directly, the VM will exit once there are no more events scheduled on the event loop, no more timers running, no open ReceivePorts, and no external streams or futures that may fire. Being able to emulate that behavior is important when using isolates to run Dart scripts.

One possible solution would be to add something like Isolate.addOnDoneListener, which would fire using the same criteria as the VM. Another solution which is probably too radical would be to have isolates automatically terminate if they have no more work to do.

This is blocking dart-lang/pub#1204.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-core-librarySDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries.library-isolate

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions