Message265721
| Author |
xdegaye |
| Recipients |
Alex.Willmer, ncoghlan, neologix, pitrou, rhettinger, vstinner, xdegaye, yan12125 |
| Date |
2016年05月16日.19:07:18 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1463425639.1.0.884683676898.issue26939@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
> I don't know if it can fix the issue, but you may see my issue #23428: "Use the monotonic clock for thread conditions on POSIX platforms".
pthread_condattr_setclock() is declared in the Android API 21 headers.
When a monotonic clock is set for pthread_cond_timedwait(), one could measure the monotonic time elapsed to execute the instructions from _PyTime_monotonic() to the setting of the ts fields in PyCOND_TIMEDWAIT(), i.e the time to execute those statements taken from your patch:
#ifdef MONOTONIC
_PyTime_monotonic(&deadline);
#else
_PyTime_gettimeofday(&deadline);
#endif
/* TODO: add overflow and truncation checks */
assert(us <= LONG_MAX);
deadline.tv_usec += (long)us;
deadline.tv_sec += deadline.tv_usec / 1000000;
deadline.tv_usec %= 1000000;
and prevent gil_interval to be set below that measured value. This would solve the problem for this soooo slow emulator. _PyTime_monotonic() does not exist, is this _PyTime_GetMonotonicClock() ? So I did not try to test it, not knowing the status of your patch.
IMHO PyCOND_TIMEDWAIT() should use a monotonic clock when available. |
|