Commit 6ccdea65 authored by Denis Bilenko's avatar Denis Bilenko

core.loop: add 'pendingcnt' property and add 'pending=<>' part to __repr__

parent b3f6b55a
...@@ -405,6 +405,11 @@ cdef public class loop [object PyGeventLoopObject, type PyGeventLoop_Type]: ...@@ -405,6 +405,11 @@ cdef public class loop [object PyGeventLoopObject, type PyGeventLoop_Type]:
return value return value
return backend return backend
property pendingcnt:
def __get__(self):
return libev.ev_pending_count(self._ptr)
def io(self, int fd, int events, ref=True, priority=None): def io(self, int fd, int events, ref=True, priority=None):
return io(self, fd, events, ref, priority) return io(self, fd, events, ref, priority)
...@@ -450,6 +455,7 @@ cdef public class loop [object PyGeventLoopObject, type PyGeventLoop_Type]: ...@@ -450,6 +455,7 @@ cdef public class loop [object PyGeventLoopObject, type PyGeventLoop_Type]:
cdef object msg = self.backend cdef object msg = self.backend
if self.default: if self.default:
msg += ' default' msg += ' default'
msg += ' pending=%s' % self.pendingcnt
#ifdef LIBEV_EMBED #ifdef LIBEV_EMBED
msg += self._format_details() msg += self._format_details()
#endif #endif
...@@ -470,10 +476,10 @@ cdef public class loop [object PyGeventLoopObject, type PyGeventLoop_Type]: ...@@ -470,10 +476,10 @@ cdef public class loop [object PyGeventLoopObject, type PyGeventLoop_Type]:
activecnt = self.activecnt activecnt = self.activecnt
except AttributeError: except AttributeError:
pass pass
if fileno is not None:
msg += ' fileno=' + repr(fileno)
if activecnt is not None: if activecnt is not None:
msg += ' ref=' + repr(activecnt) msg += ' ref=' + repr(activecnt)
if fileno is not None:
msg += ' fileno=' + repr(fileno)
if sigfd is not None and sigfd != -1: if sigfd is not None and sigfd != -1:
msg += ' sigfd=' + repr(sigfd) msg += ' sigfd=' + repr(sigfd)
return msg return msg
......
...@@ -184,3 +184,4 @@ cdef extern from "libev.h": ...@@ -184,3 +184,4 @@ cdef extern from "libev.h":
void ev_ref(ev_loop*) void ev_ref(ev_loop*)
void ev_unref(ev_loop*) void ev_unref(ev_loop*)
void ev_break(ev_loop*, int) void ev_break(ev_loop*, int)
unsigned int ev_pending_count(ev_loop*)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment