Commit 207de87e authored by Joanne Hugé's avatar Joanne Hugé

Fix issue causing infinite loop

parent 558f0fa2
...@@ -36,6 +36,9 @@ static inline int64_t diff_ns(struct timespec t1, struct timespec t2) { ...@@ -36,6 +36,9 @@ static inline int64_t diff_ns(struct timespec t1, struct timespec t2) {
diff = NSECS_PER_SECOND * (t1.tv_sec - t2.tv_sec); diff = NSECS_PER_SECOND * (t1.tv_sec - t2.tv_sec);
diff += ((int64_t)t1.tv_nsec) - ((int64_t)t2.tv_nsec); diff += ((int64_t)t1.tv_nsec) - ((int64_t)t2.tv_nsec);
if( diff < 0 )
diff = -diff;
return diff; return diff;
} }
...@@ -91,7 +94,7 @@ static void *timerthread_poll(void *p) { ...@@ -91,7 +94,7 @@ static void *timerthread_poll(void *p) {
for(;;) { for(;;) {
clock_gettime(CLOCK_ID, &current); clock_gettime(CLOCK_ID, &current);
if( current.tv_nsec == next.tv_nsec) if( current.tv_nsec >= next.tv_nsec)
break; break;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment