Modify os_cond_reltimedwait to support long time wait (#461)

Modify the argument of os_cond_reltimedwait to uint64 type to support long time wait, and handle possible integer overflow.
This commit is contained in:
Wenyong Huang
2020-12-07 17:37:53 +08:00
committed by GitHub
parent a84d51271c
commit 388530c738
16 changed files with 121 additions and 58 deletions

View File

@ -848,7 +848,7 @@ pthread_cond_wait_wrapper(wasm_exec_env_t exec_env, uint32 *cond, uint32 *mutex)
*/
static int32
pthread_cond_timedwait_wrapper(wasm_exec_env_t exec_env, uint32 *cond,
uint32 *mutex, uint32 useconds)
uint32 *mutex, uint64 useconds)
{
ThreadInfoNode *cond_info_node, *mutex_info_node;
@ -1014,7 +1014,7 @@ static NativeSymbol native_symbols_lib_pthread[] = {
REG_NATIVE_FUNC(pthread_mutex_destroy, "(*)i"),
REG_NATIVE_FUNC(pthread_cond_init, "(**)i"),
REG_NATIVE_FUNC(pthread_cond_wait, "(**)i"),
REG_NATIVE_FUNC(pthread_cond_timedwait, "(**i)i"),
REG_NATIVE_FUNC(pthread_cond_timedwait, "(**I)i"),
REG_NATIVE_FUNC(pthread_cond_signal, "(*)i"),
REG_NATIVE_FUNC(pthread_cond_destroy, "(*)i"),
REG_NATIVE_FUNC(pthread_key_create, "(*i)i"),
@ -1028,4 +1028,4 @@ get_lib_pthread_export_apis(NativeSymbol **p_lib_pthread_apis)
{
*p_lib_pthread_apis = native_symbols_lib_pthread;
return sizeof(native_symbols_lib_pthread) / sizeof(NativeSymbol);
}
}