Commit 5adec8d6 authored by Jason Madden's avatar Jason Madden

setting up to run collabcks is different, libev just refs self, libev needs to start the timer.

fixes test__loop_callback.
parent d83df914
...@@ -443,10 +443,13 @@ class AbstractLoop(object): ...@@ -443,10 +443,13 @@ class AbstractLoop(object):
def callback(self, priority=None): def callback(self, priority=None):
return callback(self, priority) return callback(self, priority)
def _setup_for_run_callback(self):
raise NotImplementedError()
def run_callback(self, func, *args): def run_callback(self, func, *args):
cb = callback(func, args) cb = callback(func, args)
self._callbacks.append(cb) self._callbacks.append(cb)
self.ref() self._setup_for_run_callback()
return cb return cb
......
...@@ -267,6 +267,9 @@ class loop(AbstractLoop): ...@@ -267,6 +267,9 @@ class loop(AbstractLoop):
self.ref() self.ref()
libev.ev_check_stop(self._ptr, self._check) libev.ev_check_stop(self._ptr, self._check)
def _setup_for_run_callback(self):
self.ref() # we should go through the loop now
def destroy(self): def destroy(self):
global _default_loop_destroyed global _default_loop_destroyed
if self._ptr: if self._ptr:
......
...@@ -75,6 +75,10 @@ class loop(AbstractLoop): ...@@ -75,6 +75,10 @@ class loop(AbstractLoop):
libuv.uv_check_stop(self._check) libuv.uv_check_stop(self._check)
libuv.uv_ref(self._check) libuv.uv_ref(self._check)
def _setup_for_run_callback(self):
self._start_callback_timer()
libuv.uv_ref(self._timer0)
def destroy(self): def destroy(self):
if self._ptr: if self._ptr:
ptr = self._ptr ptr = self._ptr
......
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