Commit 32d9e236 authored by Denis Bilenko's avatar Denis Bilenko

core: remove 'sent' property; make 'async.pending' property use ev_async_pending()

parent 16baea38
......@@ -500,11 +500,6 @@ cdef public class loop [object PyGeventLoopObject, type PyGeventLoop_Type]:
Py_DECREF(<PyObjectPtr>self) \
self._flags &= ~1 \
\
property pending: \
\
def __get__(self): \
return True if libev.ev_is_pending(&self._watcher) else False \
\
property priority: \
\
def __get__(self): \
......@@ -534,11 +529,22 @@ cdef public class loop [object PyGeventLoopObject, type PyGeventLoop_Type]:
libev.ev_##TYPE##_start(self.loop._ptr, &self._watcher) \
PYTHON_INCREF
#define PENDING \
property pending: \
\
def __get__(self): \
return True if libev.ev_is_pending(&self._watcher) else False
#define WATCHER(TYPE) WATCHER_BASE(TYPE) \
\
START(TYPE) \
\
ACTIVE
ACTIVE \
\
PENDING
#define COMMA ,
......@@ -594,6 +600,8 @@ cdef public class io(watcher) [object PyGeventIOObject, type PyGeventIO_Type]:
ACTIVE
PENDING
#ifdef _WIN32
def __init__(self, loop loop, long fd, int events, ref=True):
......@@ -680,6 +688,8 @@ cdef public class timer(watcher) [object PyGeventTimerObject, type PyGeventTimer
ACTIVE
PENDING
def __init__(self, loop loop, double after=0.0, double repeat=0.0, ref=True):
if repeat < 0.0:
raise ValueError("repeat must be positive or zero: %r" % repeat)
......@@ -750,17 +760,22 @@ cdef public class fork(watcher) [object PyGeventForkObject, type PyGeventFork_Ty
cdef public class async(watcher) [object PyGeventAsyncObject, type PyGeventAsync_Type]:
WATCHER(async)
WATCHER_BASE(async)
START(async)
ACTIVE
property pending:
def __get__(self):
return True if libev.ev_async_pending(&self._watcher) else False
INIT(async,,)
def send(self):
libev.ev_async_send(self.loop._ptr, &self._watcher)
@property
def sent(self):
return libev.ev_async_pending(&self._watcher)
#cdef public class child(watcher) [object PyGeventChildObject, type PyGeventChild_Type]:
#
......@@ -788,6 +803,8 @@ cdef public class callback(watcher) [object PyGeventCallbackObject, type PyGeven
def __get__(self):
return self.callback is not None
PENDING
__SYSERR_CALLBACK = None
......
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