killIsolates method
killAll for the isolates and their ports only. The counter, the session store and the bus of this isolate stay as they are.
Implementation
void killIsolates({bool now = false}) {
stopped = true;
isolates.forEach((int id, Isolate isolate) {
isolate.kill(priority: now ? Isolate.immediate : Isolate.beforeNextEvent);
});
receivePorts.forEach((int id, List<ReceivePort> ports) {
for (ReceivePort port in ports) {
port.close();
}
});
// the exit ports are closed, so the bus is told here
for (int id in receivePorts.keys) {
IsolateBus.instance.drop(id);
}
isolates.clear();
receivePorts.clear();
sendPorts.clear();
ready.clear();
}