Implement wasm_runtime_init_thread_env for Windows platform (#683)
Implement wasm_runtime_init_thread_env() for Windows platform by calling os_thread_env_init(): if current thread is created by developer himself but not runtime, developer should call wasm_runtime_init_thread_env() to init the thread environment before calling wasm function, and call wasm_runtime_destroy_thread_env() before thread exits. And clear compile warnings for Windows platform, fix compile error for AliOS-Things platform Signed-off-by: Wenyong Huang <wenyong.huang@intel.com>
This commit is contained in:
@ -823,9 +823,19 @@ wasm_runtime_destroy_exec_env(WASMExecEnv *exec_env)
|
||||
bool
|
||||
wasm_runtime_init_thread_env()
|
||||
{
|
||||
#ifdef BH_PLATFORM_WINDOWS
|
||||
if (os_thread_env_init() != 0)
|
||||
return false;
|
||||
#endif
|
||||
|
||||
#if WASM_ENABLE_AOT != 0
|
||||
#ifdef OS_ENABLE_HW_BOUND_CHECK
|
||||
return aot_signal_init();
|
||||
if (!aot_signal_init()) {
|
||||
#ifdef BH_PLATFORM_WINDOWS
|
||||
os_thread_env_destroy();
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
return true;
|
||||
@ -839,6 +849,10 @@ wasm_runtime_destroy_thread_env()
|
||||
aot_signal_destroy();
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef BH_PLATFORM_WINDOWS
|
||||
os_thread_env_destroy();
|
||||
#endif
|
||||
}
|
||||
|
||||
#if (WASM_ENABLE_MEMORY_PROFILING != 0) || (WASM_ENABLE_MEMORY_TRACING != 0)
|
||||
|
||||
Reference in New Issue
Block a user