Unverified Commit 947ffa1f authored by Alexander Aprelev's avatar Alexander Aprelev Committed by GitHub

Use recently introduced Isolate.exit() in compute implementation (#91124)

* Use recently introduced Isolate.exit() in compute implementation

* Remove unused isolate variable
parent e9a86c4a
......@@ -19,7 +19,7 @@ Future<R> compute<Q, R>(isolates.ComputeCallback<Q, R> callback, Q message, { St
final ReceivePort exitPort = ReceivePort();
final ReceivePort errorPort = ReceivePort();
Timeline.finishSync();
final Isolate isolate = await Isolate.spawn<_IsolateConfiguration<Q, FutureOr<R>>>(
await Isolate.spawn<_IsolateConfiguration<Q, FutureOr<R>>>(
_spawn,
_IsolateConfiguration<Q, FutureOr<R>>(
callback,
......@@ -61,7 +61,6 @@ Future<R> compute<Q, R>(isolates.ComputeCallback<Q, R> callback, Q message, { St
resultPort.close();
exitPort.close();
errorPort.close();
isolate.kill();
Timeline.finishSync();
return result.future;
}
......@@ -94,8 +93,8 @@ Future<void> _spawn<Q, R>(_IsolateConfiguration<Q, FutureOr<R>> configuration) a
flow: Flow.step(configuration.flowId),
);
Timeline.timeSync(
'${configuration.debugLabel}: returning result',
() { configuration.resultPort.send(result); },
'${configuration.debugLabel}: exiting and returning a result', () {},
flow: Flow.step(configuration.flowId),
);
Isolate.exit(configuration.resultPort, result);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment