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
097890fc
Commit
097890fc
authored
Apr 06, 2011
by
Denis Bilenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
simplify implementation for select
parent
1e94acd1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
10 deletions
+10
-10
gevent/select.py
gevent/select.py
+10
-10
No files found.
gevent/select.py
View file @
097890fc
...
...
@@ -2,7 +2,7 @@
from
gevent.timeout
import
Timeout
from
gevent.event
import
Event
from
gevent.core
import
MAXPRI
,
READ
,
WRITE
,
EVENTS
from
gevent.core
import
MAXPRI
,
READ
,
WRITE
from
gevent.hub
import
get_hub
__implements__
=
[
'select'
]
...
...
@@ -32,13 +32,13 @@ class SelectResult(object):
self
.
write
=
[]
self
.
event
=
Event
()
def
update
(
self
,
events
,
socket
):
if
events
&
READ
:
self
.
read
.
append
(
socket
)
self
.
event
.
set
()
elif
events
&
WRITE
:
self
.
write
.
append
(
socket
)
self
.
event
.
set
()
def
add_read
(
self
,
socket
):
self
.
read
.
append
(
socket
)
self
.
event
.
set
(
)
def
add_write
(
self
,
socket
)
:
self
.
write
.
append
(
socket
)
self
.
event
.
set
()
def
select
(
rlist
,
wlist
,
xlist
,
timeout
=
None
):
...
...
@@ -55,12 +55,12 @@ def select(rlist, wlist, xlist, timeout=None):
for
readfd
in
rlist
:
watcher
=
io
(
get_fileno
(
readfd
),
1
)
watcher
.
priority
=
MAXPRI
watcher
.
start
(
result
.
update
,
EVENTS
,
readfd
)
watcher
.
start
(
result
.
add_read
,
readfd
)
watchers
.
append
(
watcher
)
for
writefd
in
wlist
:
watcher
=
io
(
get_fileno
(
writefd
),
2
)
watcher
.
priority
=
MAXPRI
watcher
.
start
(
result
.
update
,
EVENTS
,
writefd
)
watcher
.
start
(
result
.
add_write
,
writefd
)
watchers
.
append
(
watcher
)
except
IOError
,
ex
:
raise
error
(
*
ex
.
args
)
...
...
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