From API version 22, ARKUI_MULTI_THREAD_NATIVE_NODE is added to ArkUI_NativeAPIVariantKind.
Call the OH_ArkUI_GetModuleInterface API and pass ARKUI_MULTI_THREAD_NATIVE_NODE as the input parameter to obtain the multi-threaded NDK API set. Refer to Using Multi-threaded NDK APIs for the complete example.
Problem
Calling a multi-threaded NDK API returns the ARKUI_ERROR_CODE_NODE_ON_INVALID_THREAD error code.
Solution
Refer to Multi-threaded NDK API Set Specifications to check whether the called API supports multi-thread calling, and then perform the following steps:
When multi-threaded NDK APIs are used, multiple threads operate the same component or component tree at the same time. In this case, thread safety cannot be ensured. You need to avoid this situation through proper architectural design.
You can follow the restrictions in Multi-threaded NDK API Set Specifications to ensure thread safety.