diff options
author | Victor Stinner <vstinner@python.org> | 2021-10-01 11:03:03 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-01 11:03:03 (GMT) |
commit | 98d282700221234157159df4af76423d89490ad9 (patch) | |
tree | 5f552e24b2945e6db9fa750afe4a3d135b6bb546 /Include | |
parent | 746d648d47d12d16c2afedaeff626fc6aaaf6a46 (diff) | |
download | cpython-98d282700221234157159df4af76423d89490ad9.zip cpython-98d282700221234157159df4af76423d89490ad9.tar.gz cpython-98d282700221234157159df4af76423d89490ad9.tar.bz2 |
bpo-41710: Fix PY_TIMEOUT_MAX on Windows (GH-28673)
WaitForSingleObject() accepts timeout in milliseconds in the range
[0; 0xFFFFFFFE] (DWORD type). INFINITE value (0xFFFFFFFF) means no
timeout. 0xFFFFFFFE milliseconds is around 49.7 days.
PY_TIMEOUT_MAX is (0xFFFFFFFE * 1000) milliseconds on Windows, around
49.7 days.
Partially revert commit 37b8294d6295ca12553fd7c98778be71d24f4b24.
Diffstat (limited to 'Include')
-rw-r--r-- | Include/pythread.h | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/Include/pythread.h b/Include/pythread.h index cf4cc9a..1a6092c 100644 --- a/Include/pythread.h +++ b/Include/pythread.h @@ -61,11 +61,11 @@ PyAPI_FUNC(int) _PyThread_at_fork_reinit(PyThread_type_lock *lock); convert microseconds to nanoseconds. */ # define PY_TIMEOUT_MAX (LLONG_MAX / 1000) #elif defined (NT_THREADS) - /* In the NT API, the timeout is a DWORD and is expressed in milliseconds, - * a positive number between 0 and 0x7FFFFFFF (see WaitForSingleObject() - * documentation). */ -# if 0x7FFFFFFFLL * 1000 < LLONG_MAX -# define PY_TIMEOUT_MAX (0x7FFFFFFFLL * 1000) + // WaitForSingleObject() accepts timeout in milliseconds in the range + // [0; 0xFFFFFFFE] (DWORD type). INFINITE value (0xFFFFFFFF) means no + // timeout. 0xFFFFFFFE milliseconds is around 49.7 days. +# if 0xFFFFFFFELL * 1000 < LLONG_MAX +# define PY_TIMEOUT_MAX (0xFFFFFFFELL * 1000) # else # define PY_TIMEOUT_MAX LLONG_MAX # endif |