mirror of
https://github.com/libretro/RetroArch.git
synced 2025-04-02 10:51:52 -04:00
Update scond_wait_timeout
This commit is contained in:
parent
9960d88d32
commit
76fe1163c2
1 changed files with 5 additions and 4 deletions
|
@ -383,6 +383,7 @@ bool scond_wait_timeout(scond_t *cond, slock_t *lock, int64_t timeout_us)
|
|||
return ret == WAIT_OBJECT_0;
|
||||
#else
|
||||
int ret;
|
||||
int64_t seconds, remainder;
|
||||
struct timespec now = {0};
|
||||
|
||||
#ifdef __MACH__
|
||||
|
@ -413,11 +414,11 @@ bool scond_wait_timeout(scond_t *cond, slock_t *lock, int64_t timeout_us)
|
|||
clock_gettime(CLOCK_REALTIME, &now);
|
||||
#endif
|
||||
|
||||
now.tv_sec += timeout_us / 1000000;
|
||||
now.tv_nsec += timeout_us * 1000;
|
||||
seconds = timeout_us / INT64_C(1000000);
|
||||
remainder = timeout_us % INT64_C(1000000);
|
||||
|
||||
now.tv_sec += now.tv_nsec / 1000000000;
|
||||
now.tv_nsec = now.tv_nsec % 1000000000;
|
||||
now.tv_sec += seconds;
|
||||
now.tv_nsec += remainder * INT64_C(1000);
|
||||
|
||||
ret = pthread_cond_timedwait(&cond->cond, &lock->lock, &now);
|
||||
return (ret == 0);
|
||||
|
|
Loading…
Add table
Reference in a new issue