ArkTS子线程回到主线程只能通过消息传递,比如worker通过postMessage和onmessage来发送和接收消息,taskpool通过返回值传递。@Concurrent function printArgs(args: number): number { console.info("printArgs: " + args); return args; } taskpool.execute(printArgs, 100).then((value: Object) => { // 100: test number console.info("taskpool result: " + value); });参考官方文档:https://developer.huawei.com/consumer/cn/doc/harmonyos-references-V5/js-apis-taskpool-V5https://developer.huawei.com/consumer/cn/doc/harmonyos-references-V5/js-apis-worker-V5
ArkTS子线程回到主线程只能通过消息传递,比如worker通过postMessage和onmessage来发送和接收消息,taskpool通过返回值传递。
参考官方文档:
https://developer.huawei.com/consumer/cn/doc/harmonyos-references-V5/js-apis-taskpool-V5
https://developer.huawei.com/consumer/cn/doc/harmonyos-references-V5/js-apis-worker-V5