Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gevent
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gevent
Commits
bde0675e
Commit
bde0675e
authored
Jul 10, 2015
by
Eddi Linder
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't implement poll when python doesn't have one
parent
b3793ee5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
46 additions
and
52 deletions
+46
-52
gevent/select.py
gevent/select.py
+46
-52
No files found.
gevent/select.py
View file @
bde0675e
...
...
@@ -77,65 +77,59 @@ def select(rlist, wlist, xlist, timeout=None):
for
watcher
in
watchers
:
watcher
.
stop
()
class
PollResult
(
object
):
__slots__
=
[
'events'
,
'event'
]
def
__init__
(
self
):
self
.
events
=
set
()
self
.
event
=
Event
()
def
add_event
(
self
,
events
,
fd
):
result_flags
=
0
result_flags
|=
POLLIN
if
events
&
1
else
0
result_flags
|=
POLLOUT
if
events
&
2
else
0
self
.
events
.
add
((
fd
,
result_flags
))
self
.
event
.
set
()
class
poll
(
object
):
def
__init__
(
self
):
self
.
fds
=
{}
self
.
loop
=
get_hub
().
loop
# Using the original poll to handle immediate response polling.
# Using the ev based way, we receive a signal on the first descriptor.
self
.
poll_obj
=
None
if
original_poll
is
not
None
:
if
original_poll
is
not
None
:
class
PollResult
(
object
):
__slots__
=
[
'events'
,
'event'
]
def
__init__
(
self
):
self
.
events
=
set
()
self
.
event
=
Event
()
def
add_event
(
self
,
events
,
fd
):
result_flags
=
0
result_flags
|=
POLLIN
if
events
&
1
else
0
result_flags
|=
POLLOUT
if
events
&
2
else
0
self
.
events
.
add
((
fd
,
result_flags
))
self
.
event
.
set
()
class
poll
(
object
):
def
__init__
(
self
):
self
.
fds
=
{}
self
.
loop
=
get_hub
().
loop
# Using the original poll to handle immediate response polling.
# Using the ev based way, we receive a signal on the first descriptor.
self
.
poll_obj
=
original_poll
()
def
register
(
self
,
fd
,
eventmask
=
POLLIN
|
POLLOUT
):
flags
=
0
flags
|=
1
if
eventmask
&
POLLIN
else
0
flags
|=
2
if
eventmask
&
POLLOUT
else
0
watcher
=
self
.
loop
.
io
(
get_fileno
(
fd
),
flags
)
watcher
.
priority
=
self
.
loop
.
MAXPRI
self
.
fds
[
fd
]
=
watcher
if
self
.
poll_obj
:
def
register
(
self
,
fd
,
eventmask
=
POLLIN
|
POLLOUT
):
flags
=
0
flags
|=
1
if
eventmask
&
POLLIN
else
0
flags
|=
2
if
eventmask
&
POLLOUT
else
0
watcher
=
self
.
loop
.
io
(
get_fileno
(
fd
),
flags
)
watcher
.
priority
=
self
.
loop
.
MAXPRI
self
.
fds
[
fd
]
=
watcher
self
.
poll_obj
.
register
(
fd
,
eventmask
)
def
modify
(
self
,
fd
,
eventmask
):
self
.
register
(
fd
,
eventmask
)
if
self
.
poll_obj
:
def
modify
(
self
,
fd
,
eventmask
):
self
.
register
(
fd
,
eventmask
)
self
.
poll_obj
.
modify
(
fd
,
eventmask
)
def
poll
(
self
,
timeout
=
None
):
if
self
.
poll_obj
:
def
poll
(
self
,
timeout
=
None
):
results
=
self
.
poll_obj
.
poll
(
0
)
if
results
:
return
results
result
=
PollResult
()
try
:
for
fd
in
self
.
fds
:
self
.
fds
[
fd
].
start
(
result
.
add_event
,
get_fileno
(
fd
),
pass_events
=
True
)
if
timeout
is
not
None
and
-
1
<
timeout
:
timeout
/=
1000.0
result
.
event
.
wait
(
timeout
=
timeout
)
return
list
(
result
.
events
)
finally
:
for
fd
in
self
.
fds
:
self
.
fds
[
fd
].
stop
()
def
unregister
(
self
,
fd
):
self
.
fds
.
pop
(
fd
,
None
)
if
self
.
poll_obj
:
result
=
PollResult
()
try
:
for
fd
in
self
.
fds
:
self
.
fds
[
fd
].
start
(
result
.
add_event
,
get_fileno
(
fd
),
pass_events
=
True
)
if
timeout
is
not
None
and
-
1
<
timeout
:
timeout
/=
1000.0
result
.
event
.
wait
(
timeout
=
timeout
)
return
list
(
result
.
events
)
finally
:
for
fd
in
self
.
fds
:
self
.
fds
[
fd
].
stop
()
def
unregister
(
self
,
fd
):
self
.
fds
.
pop
(
fd
,
None
)
self
.
poll_obj
.
unregister
(
fd
)
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