From 6052018e77656b503ed2a62e5eb605264299f654 Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Mon, 20 Feb 2023 16:42:25 +0800 Subject: [PATCH] fix:dispatch_semaphore_wait use error --- source/os/src/osSemaphore.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source/os/src/osSemaphore.c b/source/os/src/osSemaphore.c index 2f947d3252..1f2df09ce1 100644 --- a/source/os/src/osSemaphore.c +++ b/source/os/src/osSemaphore.c @@ -132,7 +132,8 @@ int tsem_wait(tsem_t *psem) { int tsem_timewait(tsem_t *psem, int64_t milis) { if (psem == NULL || *psem == NULL) return -1; - dispatch_semaphore_wait(*psem, milis * 1000 * 1000); + dispatch_time_t time = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(milis * USEC_PER_SEC)); + dispatch_semaphore_wait(*psem, time); return 0; } -- GitLab