admin管理员组文章数量:1125610
How to introduce Cangjie-lang's spawn thread into ArkTs-lang? As ArkTs/Ts/Js's ThreadPool is too complicated for me.
maybe a testSpawn interface can be implemented like testCJ does, allowing ArkTs/Ts/Js code run in it:
package ohos_app_cangjie_entry
internal import ohos.ark_interop.JSModule
internal import ohos.ark_interop.JSContext
internal import ohos.ark_interop.JSCallInfo
internal import ohos.ark_interop.JSValue
internal import cj_res_entry.app
func testCJ(runtime: JSContext, callInfo: JSCallInfo): JSValue {
let value = callInfo[0].toString(runtime)
let result = "Hello ${value}"
runtime.string(result).toJSValue()
}
let EXPORT_MODULE = JSModule.registerModule {
runtime, exports => exports["testCJ"] = runtime.function(testCJ).toJSValue()
}
本文标签: multithreadingHow to introduce Cangjielang39s spawn thread into ArkTslangStack Overflow
版权声明:本文标题:multithreading - How to introduce Cangjie-lang's spawn thread into ArkTs-lang? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736665277a1946629.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论