Skip to content

Commit 15842bd

Browse files
committed
fix ug_pthread_cond_timedwait tmout compute
If the second changes during the wait, the timeout will actually increase rather than decrease. Fortunately not a big problem now, it is used just in vdisp/gl so at worst the windows would have gone irresponsive if no video is coming.
1 parent 053930f commit 15842bd

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/utils/pthread.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ ug_pthread_cond_timedwait(pthread_cond_t *cv, pthread_mutex_t *lock,
9494
clock_gettime(CLOCK_MONOTONIC, &t1);
9595
// adjust timeout
9696
*timeout_ns -=
97-
((t0.tv_sec - t1.tv_sec) * NS_IN_SEC) + (t1.tv_nsec - t0.tv_nsec);
97+
((t1.tv_sec - t0.tv_sec) * NS_IN_SEC) + (t1.tv_nsec - t0.tv_nsec);
9898
if (*timeout_ns < 0) {
9999
*timeout_ns = 0;
100100
}

0 commit comments

Comments
 (0)