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
3f6af410
Commit
3f6af410
authored
Jan 06, 2020
by
Jason Madden
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support new backends in libev.
parent
5d2801a9
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
60 additions
and
27 deletions
+60
-27
src/gevent/libev/_corecffi_cdef.c
src/gevent/libev/_corecffi_cdef.c
+2
-0
src/gevent/libev/corecext.pyx
src/gevent/libev/corecext.pyx
+27
-15
src/gevent/libev/corecffi.py
src/gevent/libev/corecffi.py
+17
-9
src/gevent/libev/libev.pxd
src/gevent/libev/libev.pxd
+2
-0
src/gevent/tests/test__close_backend_fd.py
src/gevent/tests/test__close_backend_fd.py
+12
-3
No files found.
src/gevent/libev/_corecffi_cdef.c
View file @
3f6af410
...
...
@@ -43,6 +43,8 @@
#define EVBACKEND_KQUEUE ...
#define EVBACKEND_DEVPOLL ...
#define EVBACKEND_PORT ...
#define EVBACKEND_LINUXAIO ...
#define EVBACKEND_IOURING ...
/* #define EVBACKEND_IOCP ... */
#define EVBACKEND_ALL ...
...
...
src/gevent/libev/corecext.pyx
View file @
3f6af410
...
...
@@ -103,11 +103,16 @@ READWRITE = libev.EV_READ | libev.EV_WRITE
MINPRI
=
libev
.
EV_MINPRI
MAXPRI
=
libev
.
EV_MAXPRI
BACKEND_PORT
=
libev
.
EVBACKEND_PORT
BACKEND_KQUEUE
=
libev
.
EVBACKEND_KQUEUE
BACKEND_EPOLL
=
libev
.
EVBACKEND_EPOLL
BACKEND_POLL
=
libev
.
EVBACKEND_POLL
BACKEND_SELECT
=
libev
.
EVBACKEND_SELECT
BACKEND_POLL
=
libev
.
EVBACKEND_POLL
BACKEND_EPOLL
=
libev
.
EVBACKEND_EPOLL
BACKEND_KQUEUE
=
libev
.
EVBACKEND_KQUEUE
BACKEND_DEVPOLL
=
libev
.
EVBACKEND_DEVPOLL
BACKEND_PORT
=
libev
.
EVBACKEND_PORT
BACKEND_LINUXAIO
=
libev
.
EVBACKEND_LINUXAIO
BACKEND_IOURING
=
libev
.
EVBACKEND_IOURING
FORKCHECK
=
libev
.
EVFLAG_FORKCHECK
NOINOTIFY
=
libev
.
EVFLAG_NOINOTIFY
SIGNALFD
=
libev
.
EVFLAG_SIGNALFD
...
...
@@ -133,17 +138,24 @@ def get_header_version():
return
'libev-%d.%02d'
%
(
libev
.
EV_VERSION_MAJOR
,
libev
.
EV_VERSION_MINOR
)
# This list backends in the order they are actually tried by libev
_flags
=
[(
libev
.
EVBACKEND_PORT
,
'port'
),
(
libev
.
EVBACKEND_KQUEUE
,
'kqueue'
),
(
libev
.
EVBACKEND_EPOLL
,
'epoll'
),
(
libev
.
EVBACKEND_POLL
,
'poll'
),
(
libev
.
EVBACKEND_SELECT
,
'select'
),
(
libev
.
EVFLAG_NOENV
,
'noenv'
),
(
libev
.
EVFLAG_FORKCHECK
,
'forkcheck'
),
(
libev
.
EVFLAG_NOINOTIFY
,
'noinotify'
),
(
libev
.
EVFLAG_SIGNALFD
,
'signalfd'
),
(
libev
.
EVFLAG_NOSIGMASK
,
'nosigmask'
)]
# This list backends in the order they are actually tried by libev,
# as defined in loop_init. The names must be lower case.
_flags
=
[
# IOCP
(
libev
.
EVBACKEND_PORT
,
'port'
),
(
libev
.
EVBACKEND_KQUEUE
,
'kqueue'
),
(
libev
.
EVBACKEND_IOURING
,
'linux_iouring'
),
(
libev
.
EVBACKEND_LINUXAIO
,
"linux_aio"
),
(
libev
.
EVBACKEND_EPOLL
,
'epoll'
),
(
libev
.
EVBACKEND_POLL
,
'poll'
),
(
libev
.
EVBACKEND_SELECT
,
'select'
),
(
libev
.
EVFLAG_NOENV
,
'noenv'
),
(
libev
.
EVFLAG_FORKCHECK
,
'forkcheck'
),
(
libev
.
EVFLAG_NOINOTIFY
,
'noinotify'
),
(
libev
.
EVFLAG_SIGNALFD
,
'signalfd'
),
(
libev
.
EVFLAG_NOSIGMASK
,
'nosigmask'
)
]
_flags_str2int
=
dict
((
string
,
flag
)
for
(
flag
,
string
)
in
_flags
)
...
...
src/gevent/libev/corecffi.py
View file @
3f6af410
...
...
@@ -110,15 +110,23 @@ def get_version():
def
get_header_version
():
return
'libev-%d.%02d'
%
(
libev
.
EV_VERSION_MAJOR
,
libev
.
EV_VERSION_MINOR
)
_flags
=
[(
libev
.
EVBACKEND_PORT
,
'port'
),
(
libev
.
EVBACKEND_KQUEUE
,
'kqueue'
),
(
libev
.
EVBACKEND_EPOLL
,
'epoll'
),
(
libev
.
EVBACKEND_POLL
,
'poll'
),
(
libev
.
EVBACKEND_SELECT
,
'select'
),
(
libev
.
EVFLAG_NOENV
,
'noenv'
),
(
libev
.
EVFLAG_FORKCHECK
,
'forkcheck'
),
(
libev
.
EVFLAG_SIGNALFD
,
'signalfd'
),
(
libev
.
EVFLAG_NOSIGMASK
,
'nosigmask'
)]
# This list backends in the order they are actually tried by libev,
# as defined in loop_init. The names must be lower case.
_flags
=
[
# IOCP --- not supported/used.
(
libev
.
EVBACKEND_PORT
,
'port'
),
(
libev
.
EVBACKEND_KQUEUE
,
'kqueue'
),
(
libev
.
EVBACKEND_IOURING
,
'linux_iouring'
),
(
libev
.
EVBACKEND_LINUXAIO
,
"linux_aio"
),
(
libev
.
EVBACKEND_EPOLL
,
'epoll'
),
(
libev
.
EVBACKEND_POLL
,
'poll'
),
(
libev
.
EVBACKEND_SELECT
,
'select'
),
(
libev
.
EVFLAG_NOENV
,
'noenv'
),
(
libev
.
EVFLAG_FORKCHECK
,
'forkcheck'
),
(
libev
.
EVFLAG_SIGNALFD
,
'signalfd'
),
(
libev
.
EVFLAG_NOSIGMASK
,
'nosigmask'
)
]
_flags_str2int
=
dict
((
string
,
flag
)
for
(
flag
,
string
)
in
_flags
)
...
...
src/gevent/libev/libev.pxd
View file @
3f6af410
...
...
@@ -74,6 +74,8 @@ cdef extern from "libev.h" nogil:
int
EVBACKEND_DEVPOLL
int
EVBACKEND_PORT
int
EVBACKEND_IOCP
int
EVBACKEND_IOURING
int
EVBACKEND_LINUXAIO
int
EVBACKEND_ALL
int
EVBACKEND_MASK
...
...
src/gevent/tests/test__close_backend_fd.py
View file @
3f6af410
...
...
@@ -22,6 +22,13 @@ class Test(unittest.TestCase):
assertRaisesRegex
=
getattr
(
unittest
.
TestCase
,
'assertRaisesRegex'
,
getattr
(
unittest
.
TestCase
,
'assertRaisesRegexp'
))
BACKENDS_THAT_SUCCEED_WHEN_FD_CLOSED
=
(
'kqueue'
,
'epoll'
,
'linux_aio'
,
'linux_iouring'
,
)
def
_check_backend
(
self
,
backend
):
hub
=
Hub
(
backend
,
default
=
False
)
try
:
...
...
@@ -33,9 +40,10 @@ class Test(unittest.TestCase):
raise
unittest
.
SkipTest
(
"backend %s lacks fileno"
%
(
backend
,))
os
.
close
(
fileno
)
if
backend
not
in
(
'kqueue'
,
'epoll'
):
# That's actually all the libev backends that use a file descriptor,
# right?
if
backend
in
self
.
BACKENDS_THAT_SUCCEED_WHEN_FD_CLOSED
:
gevent
.
sleep
(
0.001
)
else
:
with
self
.
assertRaisesRegex
(
SystemError
,
"(libev)"
):
gevent
.
sleep
(
0.001
)
...
...
@@ -52,6 +60,7 @@ class Test(unittest.TestCase):
return
test
.
__name__
,
test
count
=
backend
=
None
for
count
in
range
(
2
):
for
backend
in
core
.
supported_backends
():
name
,
func
=
_make_test
(
count
,
backend
)
...
...
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