Xavier de Gaye added the comment:
> 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.
----------
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue26939>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com