Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
626347ce
Commit
626347ce
authored
Jan 31, 2014
by
Victor Stinner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #20455: asyncio: use the same code to round a timeout than the selectors
module Sort also imports
parent
fa0969ce
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
4 deletions
+9
-4
Lib/asyncio/windows_events.py
Lib/asyncio/windows_events.py
+9
-4
No files found.
Lib/asyncio/windows_events.py
View file @
626347ce
"""Selector and proactor eventloops for Windows."""
import
_winapi
import
errno
import
math
import
socket
import
struct
import
subprocess
import
weakref
import
struct
import
_winapi
from
.
import
events
from
.
import
base_subprocess
...
...
@@ -325,7 +326,9 @@ class IocpProactor:
if
timeout
is
None
:
ms
=
_winapi
.
INFINITE
else
:
ms
=
int
(
timeout
*
1000
+
0.5
)
# RegisterWaitForSingleObject() has a resolution of 1 millisecond,
# round away from zero to wait *at least* timeout seconds.
ms
=
math
.
ceil
(
timeout
*
1e3
)
# We only create ov so we can use ov.address as a key for the cache.
ov
=
_overlapped
.
Overlapped
(
NULL
)
...
...
@@ -396,7 +399,9 @@ class IocpProactor:
elif
timeout
<
0
:
raise
ValueError
(
"negative timeout"
)
else
:
ms
=
int
(
timeout
*
1000
+
0.5
)
# GetQueuedCompletionStatus() has a resolution of 1 millisecond,
# round away from zero to wait *at least* timeout seconds.
ms
=
math
.
ceil
(
timeout
*
1e3
)
if
ms
>=
INFINITE
:
raise
ValueError
(
"timeout too big"
)
while
True
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment