-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Support Isolate.addOnExitListener #20828
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
This comment was originally written by @zoechi I also tried to find a solution for this. |
cc @iposva-google. |
Added this to the 1.7 milestone. |
Removed Area-Library label. |
This comment was originally written by [email protected] On which platforms are the kill() and addOnExitListener() supported (i.e. why are they declared in the class at all if nothing supports them)? I would be willing to attempt to implement them, at least for OS X and maybe Linux, if I had a bit of direction as to what needs to be done to make them work. |
This comment was originally written by [email protected] Ah, those methods seem to be supported on exactly zero platforms: https://github.com/dart-lang/bleeding_edge/blob/59d02fbda66c0cf4cf4f97fbb0db44759a7b6f30/dart/runtime/lib/isolate_patch.dart#L344. Sad. |
The methods are are implemented by dart2js. |
The removeOnExitListener should also be implemented with the addOnExitListener. |
Marked this as blocking #21599. |
Marked this as blocking #21821. |
This comment was originally written by @zoechi see also http://dartbug.com/6945 |
This comment was originally written by @kaendfinger Also a note, how will this be handled with Isolate.current? I assume it will throw an exception? |
There is currently no special handling for the isolate returned by Isolate.current. It doesn't know that it refers to its own isolate (and since you can, in some cases, send an Isolate object to another isolate, it shouldn't assume it either). So, you can set yourself up to listen for your own exit - obviously you'll never see the event, if for no other reason then because your receive port will keep the isolate alive. |
This comment was originally written by @kaendfinger Ok. I know that Isolate.current.kill() works so it seems to mostly work :) |
Marked this as blocking #22067. |
Set owner to @sgjesse. |
As "pub run" moves to Isolates rather than spawning processes directly, it needs to be able to track an isolate's lifecycle. Currently the Isolate.addOnExitListener function exists, but throws an UnsupportedError. This function or something like it will very soon be necessary for pub.
The text was updated successfully, but these errors were encountered: