mirror of
https://github.com/libretro/beetle-psx-libretro.git
synced 2024-11-23 08:49:47 +00:00
rthreads: fix bug in scond_wait_timeout
Handle nanosecond count overflowing a full second
This commit is contained in:
parent
9addca1d62
commit
5e386f0149
@ -808,6 +808,12 @@ bool scond_wait_timeout(scond_t *cond, slock_t *lock, int64_t timeout_us)
|
||||
now.tv_sec += seconds;
|
||||
now.tv_nsec += remainder * INT64_C(1000);
|
||||
|
||||
while (now.tv_nsec >= INT64_C(1000000000))
|
||||
{
|
||||
now.tv_sec++;
|
||||
now.tv_nsec -= INT64_C(1000000000);
|
||||
}
|
||||
|
||||
ret = pthread_cond_timedwait(&cond->cond, &lock->lock, &now);
|
||||
return (ret == 0);
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user