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
a46ed8ca
Commit
a46ed8ca
authored
May 02, 2012
by
Denis Bilenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
core: all watchers (except for child) now accept 'priority' argument to contrustructor
parent
8849ab1c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
27 deletions
+40
-27
gevent/core.ppyx
gevent/core.ppyx
+40
-27
No files found.
gevent/core.ppyx
View file @
a46ed8ca
...
...
@@ -405,26 +405,26 @@ cdef public class loop [object PyGeventLoopObject, type PyGeventLoop_Type]:
return value
return backend
def io(self, int fd, int events, ref=True):
return io(self, fd, events, ref)
def io(self, int fd, int events, ref=True
, priority=None
):
return io(self, fd, events, ref
, priority
)
def timer(self, double after, double repeat=0.0, ref=True):
return timer(self, after, repeat, ref)
def timer(self, double after, double repeat=0.0, ref=True
, priority=None
):
return timer(self, after, repeat, ref
, priority
)
def signal(self, int signum, ref=True):
return signal(self, signum, ref)
def signal(self, int signum, ref=True
, priority=None
):
return signal(self, signum, ref
, priority
)
def idle(self, ref=True):
return idle(self, ref)
def idle(self, ref=True
, priority=None
):
return idle(self, ref
, priority
)
def prepare(self, ref=True):
return prepare(self, ref)
def prepare(self, ref=True
, priority=None
):
return prepare(self, ref
, priority
)
def fork(self, ref=True):
return fork(self, ref)
def fork(self, ref=True
, priority=None
):
return fork(self, ref
, priority
)
def async(self, ref=True):
return async(self, ref)
def async(self, ref=True
, priority=None
):
return async(self, ref
, priority
)
#if EV_CHILD_ENABLE
...
...
@@ -435,14 +435,14 @@ cdef public class loop [object PyGeventLoopObject, type PyGeventLoop_Type]:
#endif
def stat(self, bytes path, float interval=0.0, ref=True):
return stat(self, path, interval, ref)
def stat(self, bytes path, float interval=0.0, ref=True
, priority=None
):
return stat(self, path, interval, ref
, priority
)
def callback(self):
return callback(self)
def callback(self
, priority=None
):
return callback(self
, priority
)
def run_callback(self, func, *args):
cdef callback result = callback(self)
def run_callback(self, func, *args
, priority=None
):
cdef callback result = callback(self
, priority
)
result.start(func, *args)
return result
...
...
@@ -617,13 +617,16 @@ cdef public class loop [object PyGeventLoopObject, type PyGeventLoop_Type]:
#define INIT(TYPE, ARGS_INITIALIZERS, ARGS) \
def __init__(self, loop loop ARGS_INITIALIZERS, ref=True
):
\
def __init__(self, loop loop ARGS_INITIALIZERS, ref=True
, priority=None):
\
libev.ev_##TYPE##_init(&self._watcher, <void *>gevent_callback_##TYPE ARGS) \
self.loop = loop \
if ref: \
self._flags = 0 \
else: \
self._flags = 4
self._flags = 4 \
if priority is not None: \
libev.ev_set_priority(&self._watcher, priority)
cdef public class watcher [object PyGeventWatcherObject, type PyGeventWatcher_Type]:
"""Abstract base class for all the watchers"""
...
...
@@ -670,7 +673,7 @@ cdef public class io(watcher) [object PyGeventIOObject, type PyGeventIO_Type]:
#ifdef _WIN32
def __init__(self, loop loop, long fd, int events, ref=True):
def __init__(self, loop loop, long fd, int events, ref=True
, priority=None
):
if events & ~(libev.EV__IOFDSET | libev.EV_READ | libev.EV_WRITE):
raise ValueError('illegal event mask: %r' % events)
cdef int vfd = libev.vfd_open(fd)
...
...
@@ -681,10 +684,12 @@ cdef public class io(watcher) [object PyGeventIOObject, type PyGeventIO_Type]:
self._flags = 0
else:
self._flags = 4
if priority is not None:
libev.ev_set_priority(&self._watcher, priority)
#else
def __init__(self, loop loop, int fd, int events, ref=True):
def __init__(self, loop loop, int fd, int events, ref=True
, priority=None
):
if fd < 0:
raise ValueError('fd must be non-negative: %r' % fd)
if events & ~(libev.EV__IOFDSET | libev.EV_READ | libev.EV_WRITE):
...
...
@@ -695,6 +700,8 @@ cdef public class io(watcher) [object PyGeventIOObject, type PyGeventIO_Type]:
self._flags = 0
else:
self._flags = 4
if priority is not None:
libev.ev_set_priority(&self._watcher, priority)
#endif
...
...
@@ -756,7 +763,7 @@ cdef public class timer(watcher) [object PyGeventTimerObject, type PyGeventTimer
PENDING
def __init__(self, loop loop, double after=0.0, double repeat=0.0, ref=True):
def __init__(self, loop loop, double after=0.0, double repeat=0.0, ref=True
, priority=None
):
if repeat < 0.0:
raise ValueError("repeat must be positive or zero: %r" % repeat)
libev.ev_timer_init(&self._watcher, <void *>gevent_callback_timer, after, repeat)
...
...
@@ -765,6 +772,8 @@ cdef public class timer(watcher) [object PyGeventTimerObject, type PyGeventTimer
self._flags = 0
else:
self._flags = 4
if priority is not None:
libev.ev_set_priority(&self._watcher, priority)
property at:
...
...
@@ -787,7 +796,7 @@ cdef public class signal(watcher) [object PyGeventSignalObject, type PyGeventSig
WATCHER(signal)
def __init__(self, loop loop, int signalnum, ref=True):
def __init__(self, loop loop, int signalnum, ref=True
, priority=None
):
if signalnum < 1 or signalnum >= signalmodule.NSIG:
raise ValueError('illegal signal number: %r' % signalnum)
# still possible to crash on one of libev's asserts:
...
...
@@ -801,6 +810,8 @@ cdef public class signal(watcher) [object PyGeventSignalObject, type PyGeventSig
self._flags = 0
else:
self._flags = 4
if priority is not None:
libev.ev_set_priority(&self._watcher, priority)
cdef public class idle(watcher) [object PyGeventIdleObject, type PyGeventIdle_Type]:
...
...
@@ -890,7 +901,7 @@ cdef public class stat(watcher) [object PyGeventStatObject, type PyGeventStat_Ty
WATCHER(stat)
cdef readonly bytes path
def __init__(self, loop loop, bytes path, float interval=0.0, ref=True):
def __init__(self, loop loop, bytes path, float interval=0.0, ref=True
, priority=None
):
self.path = path
libev.ev_stat_init(&self._watcher, <void *>gevent_callback_stat, <char*>self.path, interval)
self.loop = loop
...
...
@@ -898,6 +909,8 @@ cdef public class stat(watcher) [object PyGeventStatObject, type PyGeventStat_Ty
self._flags = 0
else:
self._flags = 4
if priority is not None:
libev.ev_set_priority(&self._watcher, priority)
property attr:
...
...
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