mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-26 15:36:14 +01:00
Fix g_cond_timed_wait() timeout with !CLOCK_MONOTONIC
g_get_monotonic_time() and g_get_real_time() now always use different clocks, so we cannot avoid correcting for their offset. Fixes failure to time out on Mac OS X. https://bugzilla.gnome.org/show_bug.cgi?id=738197
This commit is contained in:
parent
549e7b0de6
commit
0bfea5e772
@ -1564,16 +1564,10 @@ g_cond_timed_wait (GCond *cond,
|
|||||||
end_time *= 1000000;
|
end_time *= 1000000;
|
||||||
end_time += abs_time->tv_usec;
|
end_time += abs_time->tv_usec;
|
||||||
|
|
||||||
#ifdef CLOCK_MONOTONIC
|
|
||||||
/* would be nice if we had clock_rtoffset, but that didn't seem to
|
/* would be nice if we had clock_rtoffset, but that didn't seem to
|
||||||
* make it into the kernel yet...
|
* make it into the kernel yet...
|
||||||
*/
|
*/
|
||||||
end_time += g_get_monotonic_time () - g_get_real_time ();
|
end_time += g_get_monotonic_time () - g_get_real_time ();
|
||||||
#else
|
|
||||||
/* if CLOCK_MONOTONIC is not defined then g_get_montonic_time() and
|
|
||||||
* g_get_real_time() are returning the same clock, so don't bother...
|
|
||||||
*/
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return g_cond_wait_until (cond, mutex, end_time);
|
return g_cond_wait_until (cond, mutex, end_time);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user