mirror of
https://github.com/xiaoqidun/ofdgo.git
synced 2026-10-30 13:34:46 +08:00
1 parent
a0899fa150
commit
0d2e1ccdf2
2 files changed
+7
-1
No files matched your search
@@ -168,7 +168,8 @@ class NativeHost {
|
|||||||
const cancel = () => host.call("engine.cancel", {engine, id:data.id}).catch(() => {});
|
const cancel = () => host.call("engine.cancel", {engine, id:data.id}).catch(() => {});
|
||||||
controller.signal.addEventListener("abort", cancel, {once:true});
|
controller.signal.addEventListener("abort", cancel, {once:true});
|
||||||
try {
|
try {
|
||||||
await host.call("engine.start", args, controller.signal);
|
await host.call("engine.start", args);
|
||||||
|
if (controller.signal.aborted) cancel();
|
||||||
result = await completed;
|
result = await completed;
|
||||||
await host.call("engine.finish", {engine, id:data.id});
|
await host.call("engine.finish", {engine, id:data.id});
|
||||||
} finally {
|
} finally {
|
||||||
|
|||||||
@@ -775,6 +775,8 @@ func (h *Host) close() {
|
|||||||
cancel()
|
cancel()
|
||||||
}
|
}
|
||||||
engines := h.engines
|
engines := h.engines
|
||||||
|
results := h.batchResults
|
||||||
|
h.batchResults = nil
|
||||||
for _, stop := range h.engineStops {
|
for _, stop := range h.engineStops {
|
||||||
stop()
|
stop()
|
||||||
}
|
}
|
||||||
@@ -784,6 +786,9 @@ func (h *Host) close() {
|
|||||||
for _, engine := range engines {
|
for _, engine := range engines {
|
||||||
_ = engine.Close()
|
_ = engine.Close()
|
||||||
}
|
}
|
||||||
|
for _, result := range results {
|
||||||
|
h.discard(result)
|
||||||
|
}
|
||||||
_ = h.files.close()
|
_ = h.files.close()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user