문제

I'm looking through the documentation for Isolates and noticed that you can use the static method spawnUri to create an isolate from a file.

As seen here: http://api.dartlang.org/docs/releases/latest/dart_isolate/Isolate.html#spawnUri

On that document it states that it returns a future of which returns a Isolate instance however there is no other methods.

Does anyone know how exactly you go about using this instance to send messages back and forth between the isolates?

Current Code:

 Isolate.spawnUri(Uri.parse(myLibraryFileName),[],"").then((Isolate iso) { 

      // Is there a way of getting the SendPort of the isolate? 
     //Or is there other ways of calling different functions in
     //code (and being able to send messages back to the main isolate)
 });

Thank you.

도움이 되었습니까?

해결책

The methods to control the isolate are not implemented yet. Eventually we want to add methods to kill, pause, or inspect the spawned isolates.

If you want the spawned isolate to send something back you have to send a SendPort in your initial message. See the examples that came with the BREAKING CHANGE announcement:

https://groups.google.com/a/dartlang.org/forum/#!topic/misc/EVUMkZXFXtY

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top