mirror of
https://github.com/python/cpython.git
synced 2025-08-25 11:15:02 +00:00
gh-74953: _PyThread_cond_after() uses _PyTime_t (#94056)
pthread _PyThread_cond_after() implementation now uses the _PyTime_t type to handle properly overflow: clamp to the maximum value. Remove MICROSECONDS_TO_TIMESPEC() function.
This commit is contained in:
parent
616fa3465d
commit
c7a79bb036
2 changed files with 16 additions and 29 deletions
|
@ -68,9 +68,9 @@ void _PyThread_cond_after(long long us, struct timespec *abs);
|
|||
Py_LOCAL_INLINE(int)
|
||||
PyCOND_TIMEDWAIT(PyCOND_T *cond, PyMUTEX_T *mut, long long us)
|
||||
{
|
||||
struct timespec abs;
|
||||
_PyThread_cond_after(us, &abs);
|
||||
int ret = pthread_cond_timedwait(cond, mut, &abs);
|
||||
struct timespec abs_timeout;
|
||||
_PyThread_cond_after(us, &abs_timeout);
|
||||
int ret = pthread_cond_timedwait(cond, mut, &abs_timeout);
|
||||
if (ret == ETIMEDOUT) {
|
||||
return 1;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue