dart-lang / sdk

The Dart SDK, including the VM, JS and Wasm compilers, analysis, core libraries, and more.
https://dart.dev
BSD 3-Clause "New" or "Revised" License
10.27k stars 1.58k forks source link

[Feature Request] A new API to access an Isolates ID number #52976

Open maks opened 1 year ago

maks commented 1 year ago

Currently an Isolates unique, VM assigned ID number is only available via the VM service, eg using the vm_service package API.

This means it is not available when a Dart application is started with the VM service running and completely unavailable to AOT compiled Dart app executables.

Therefore I would like to propose adding a new property to the Isolate class in the dart:isolate package probably better named than just number that is currently available on the Isolate class in the vm_service package.

While it's currently possible to somewhat work around this by using user created unique IDs assigned to an Isolates debugName this is not optimal for a number of reasons.

a-siva commented 1 year ago

//cc @lrhn

lrhn commented 1 year ago

What can that ID be used for, if the VM service is not running?

maks commented 1 year ago

Thank you for looking into this! 👍🏻 🙏🏻 @lrhn The context for my requesting this is the related request in #52977 so in order to be able to key on Isolate ID's instead of re-inventing the wheel in user code, trying to use the debugName property which I think it's not intended for and then needing to do some sort of UUID generation to have unique values to set debugName to.