mirror of
https://gitee.com/openharmony/arkcompiler_ets_runtime
synced 2024-11-23 10:09:54 +00:00
Set TaskInfo to the ConcurrentFunction Set TaskInfo to the ConcurrentFunction Signed-off-by: huangfeijie <huangfeijie@huawei.com>
This commit is contained in:
parent
924f7eaa9b
commit
389fad4bae
@ -790,6 +790,15 @@ void EcmaVM::TriggerConcurrentCallback(JSTaggedValue result, JSTaggedValue hint)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void *taskInfo = reinterpret_cast<void*>(thread_->GetTaskInfo());
|
void *taskInfo = reinterpret_cast<void*>(thread_->GetTaskInfo());
|
||||||
|
if (UNLIKELY(taskInfo == nullptr)) {
|
||||||
|
JSTaggedValue extraInfoValue = functionInfo->GetFunctionExtraInfo();
|
||||||
|
if (!extraInfoValue.IsJSNativePointer()) {
|
||||||
|
LOG_ECMA(INFO) << "FunctionExtraInfo is not JSNativePointer";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
JSHandle<JSNativePointer> extraInfo(thread_, extraInfoValue);
|
||||||
|
taskInfo = extraInfo->GetData();
|
||||||
|
}
|
||||||
// clear the taskInfo when return, which can prevent the callback to get it
|
// clear the taskInfo when return, which can prevent the callback to get it
|
||||||
thread_->SetTaskInfo(reinterpret_cast<uintptr_t>(nullptr));
|
thread_->SetTaskInfo(reinterpret_cast<uintptr_t>(nullptr));
|
||||||
auto localResultRef = JSNApiHelper::ToLocal<JSValueRef>(JSHandle<JSTaggedValue>(thread_, result));
|
auto localResultRef = JSNApiHelper::ToLocal<JSValueRef>(JSHandle<JSTaggedValue>(thread_, result));
|
||||||
|
@ -4185,6 +4185,7 @@ bool JSNApi::InitForConcurrentFunction(EcmaVM *vm, Local<JSValueRef> function, v
|
|||||||
LOG_ECMA(ERROR) << "Function is not concurrent";
|
LOG_ECMA(ERROR) << "Function is not concurrent";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
JSFunction::SetFunctionExtraInfo(thread, transFunc, nullptr, nullptr, taskInfo);
|
||||||
transFunc->SetTaskConcurrentFuncFlag(1); // 1 : concurrent function flag
|
transFunc->SetTaskConcurrentFuncFlag(1); // 1 : concurrent function flag
|
||||||
thread->SetTaskInfo(reinterpret_cast<uintptr_t>(taskInfo));
|
thread->SetTaskInfo(reinterpret_cast<uintptr_t>(taskInfo));
|
||||||
thread->SetIsInConcurrentScope(true);
|
thread->SetIsInConcurrentScope(true);
|
||||||
|
Loading…
Reference in New Issue
Block a user