Message265721
> 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. |
|
Date |
User |
Action |
Args |
2016-05-16 19:07:19 | xdegaye | set | recipients:
+ xdegaye, rhettinger, ncoghlan, pitrou, vstinner, neologix, Alex.Willmer, yan12125 |
2016-05-16 19:07:19 | xdegaye | set | messageid: <1463425639.1.0.884683676898.issue26939@psf.upfronthosting.co.za> |
2016-05-16 19:07:19 | xdegaye | link | issue26939 messages |
2016-05-16 19:07:18 | xdegaye | create | |
|