mirror of
https://github.com/bytecodealliance/wasm-micro-runtime.git
synced 2025-05-14 05:31:13 +00:00
Fix win_thread.c timed wait always return 0 issue (#994)
win_thread.c os_cond_wait_internal returns os_sem_reltimed_wait or os_sem_wait result instead of always return BHT_OK before
This commit is contained in:
parent
770ca8c90c
commit
96a8bdf717
|
@ -516,10 +516,11 @@ os_cond_wait_internal(korp_cond *cond, korp_mutex *mutex, bool timed,
|
||||||
|
|
||||||
/* Unlock mutex, wait sem and lock mutex again */
|
/* Unlock mutex, wait sem and lock mutex again */
|
||||||
os_mutex_unlock(mutex);
|
os_mutex_unlock(mutex);
|
||||||
|
int wait_result;
|
||||||
if (timed)
|
if (timed)
|
||||||
os_sem_reltimed_wait(&node->sem, useconds);
|
wait_result = os_sem_reltimed_wait(&node->sem, useconds);
|
||||||
else
|
else
|
||||||
os_sem_wait(&node->sem);
|
wait_result = os_sem_wait(&node->sem);
|
||||||
os_mutex_lock(mutex);
|
os_mutex_lock(mutex);
|
||||||
|
|
||||||
/* Remove wait node from wait list */
|
/* Remove wait node from wait list */
|
||||||
|
@ -535,7 +536,7 @@ os_cond_wait_internal(korp_cond *cond, korp_mutex *mutex, bool timed,
|
||||||
}
|
}
|
||||||
os_mutex_unlock(&cond->wait_list_lock);
|
os_mutex_unlock(&cond->wait_list_lock);
|
||||||
|
|
||||||
return BHT_OK;
|
return wait_result;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
|
Loading…
Reference in New Issue
Block a user