GeezerVison is showing github.com — [3.10] bpo-41710: Fix PY_TIMEOUT_MAX value on Windows by vstinner · Pull Request #28672 · python/cpython
Conversation
vstinner
commented
Oct 1, 2021
•
edited by bedevere-bot
Loading
Uh oh!
There was an error while loading. Please reload this page.
Fix _thread.TIMEOUT_MAX value on Windows: the maximum timeout is
0x7FFFFFFF milliseconds (around 24.9 days), not 0xFFFFFFFF
milliseconds (around 49.7 days).
Set PY_TIMEOUT_MAX to 0x7FFFFFFF milliseconds, rather than 0xFFFFFFFF
milliseconds.
https://bugs.python.org/issue41710
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Fix _thread.TIMEOUT_MAX value on Windows: the maximum timeout is
0x7FFFFFFF milliseconds (around 24.9 days), not 0xFFFFFFFF
milliseconds (around 49.7 days).
Set PY_TIMEOUT_MAX to 0x7FFFFFFF milliseconds, rather than 0xFFFFFFFF
milliseconds.
|
Oh, I read WaitForSingleObject documentation of 2006 for Windows CE 3.0:
https://docs.microsoft.com/en-us/previous-versions/ms915517(v=msdn.10)
The time-out value needs to be a positive number between 0 and 0x7FFFFFFF. The maximum time-out value not equal to infinity is 0x7FFFFFFF. The infinite time-out value is 0xFFFFFFFF. Any time-out value between 0x7FFFFFFF and 0xFFFFFFFF—that is, values from 0xF0000000 through 0xFFFFFFFE—is equivalent to 0x7FFFFFFF. If you need a bigger time-out value than the maximum of 0x7FFFFFFF, use the value for infinity (0xFFFFFFFF).
Maybe this is different on Windows 10 and my change in the main branch is not correct.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
In ReactOS, WaitForSingleObject() calls WaitForSingleObjectEx() which converts "DWORD dwMilliseconds" to "LARGE_INTEGER Time" with BaseFormatTimeOut()
PLARGE_INTEGER
WINAPI
BaseFormatTimeOut(OUT PLARGE_INTEGER Timeout,
IN DWORD dwMilliseconds)
{
/* Check if this is an infinite wait, which means no timeout argument */
if (dwMilliseconds == INFINITE) return NULL;
/* Otherwise, convert the time to NT Format */
Timeout->QuadPart = dwMilliseconds * -10000LL;
return Timeout;
}
Then WaitForSingleObjectEx() calls NtWaitForSingleObject() with the "LARGE_INTEGER Time".
So I don't see any special case for values in the [0x80000000; 0xFFFFFFFE] range. Only INFINITE is special. In ReactOS, INFINITE is defined as:
#define INFINITE MAXULONG
I understand that INFINITE is equal to 0xFFFFFFFF.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
The code in the main branch, I wrote PR #28673 to fix it instead.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.