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
f440a4ff
Commit
f440a4ff
authored
Jan 29, 2010
by
Denis Bilenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
monkey: add 'aggressive' option to patch_select() and patch_all()
parent
22112e7a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
3 deletions
+11
-3
gevent/monkey.py
gevent/monkey.py
+11
-3
No files found.
gevent/monkey.py
View file @
f440a4ff
...
...
@@ -77,14 +77,22 @@ def patch_ssl():
_ssl
.
sslwrap_simple
=
sslwrap_simple
def
patch_select
():
def
patch_select
(
aggressive
=
False
):
from
gevent.select
import
select
_select
=
__import__
(
'select'
)
globals
()[
'_select_select'
]
=
_select
.
select
_select
.
select
=
select
if
aggressive
:
# since these are blocking and don't work with the libevent's event loop
# we're removing them here. This makes some other modules (e.g. asyncore)
# non-blocking, as they use select that we provide when none of these are available.
_select
.
__dict__
.
pop
(
'poll'
,
None
)
_select
.
__dict__
.
pop
(
'epoll'
,
None
)
_select
.
__dict__
.
pop
(
'kqueue'
,
None
)
_select
.
__dict__
.
pop
(
'kevent'
,
None
)
def
patch_all
(
socket
=
True
,
dns
=
True
,
time
=
True
,
select
=
True
,
thread
=
True
,
os
=
True
,
ssl
=
True
):
def
patch_all
(
socket
=
True
,
dns
=
True
,
time
=
True
,
select
=
True
,
thread
=
True
,
os
=
True
,
ssl
=
True
,
aggressive
=
False
):
# order is important
if
os
:
patch_os
()
...
...
@@ -95,7 +103,7 @@ def patch_all(socket=True, dns=True, time=True, select=True, thread=True, os=Tru
if
socket
:
patch_socket
(
dns
=
dns
)
if
select
:
patch_select
()
patch_select
(
aggressive
=
aggressive
)
if
ssl
:
patch_ssl
()
...
...
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