Fix bug in removing an EventLoop
This commit is contained in:
@@ -1173,10 +1173,11 @@ cdef class _EventLoop:
|
|||||||
self.thisptr = new UnixEventLoop()
|
self.thisptr = new UnixEventLoop()
|
||||||
|
|
||||||
def __dealloc__(self):
|
def __dealloc__(self):
|
||||||
del self.thisptr
|
self.remove()
|
||||||
|
|
||||||
def delete(self):
|
cpdef remove(self) except +reraise_kj_exception:
|
||||||
del self.thisptr
|
del self.thisptr
|
||||||
|
self.thisptr = NULL
|
||||||
|
|
||||||
# cpdef evalLater(self, func):
|
# cpdef evalLater(self, func):
|
||||||
# Py_INCREF(func)
|
# Py_INCREF(func)
|
||||||
@@ -1215,7 +1216,7 @@ DEFAULT_EVENT_LOOP = _EventLoop()
|
|||||||
def remove_event_loop():
|
def remove_event_loop():
|
||||||
global DEFAULT_EVENT_LOOP
|
global DEFAULT_EVENT_LOOP
|
||||||
|
|
||||||
DEFAULT_EVENT_LOOP.delete()
|
DEFAULT_EVENT_LOOP.remove()
|
||||||
DEFAULT_EVENT_LOOP = None
|
DEFAULT_EVENT_LOOP = None
|
||||||
|
|
||||||
cdef class _CallContext:
|
cdef class _CallContext:
|
||||||
|
|||||||
@@ -12,8 +12,7 @@ def example_client():
|
|||||||
cap = client.restore(test_capnp.TestSturdyRefObjectId.new_message(tag='testInterface'))
|
cap = client.restore(test_capnp.TestSturdyRefObjectId.new_message(tag='testInterface'))
|
||||||
cap = cap.cast_as(test_capnp.TestInterface)
|
cap = cap.cast_as(test_capnp.TestInterface)
|
||||||
|
|
||||||
remote = cap.foo(i=5)
|
response = cap.foo(i=5).wait()
|
||||||
response = remote.wait()
|
|
||||||
|
|
||||||
assert response.x == '125'
|
assert response.x == '125'
|
||||||
c.close()
|
c.close()
|
||||||
|
|||||||
@@ -35,8 +35,8 @@ def test_simple_rpc(capability):
|
|||||||
|
|
||||||
assert response.x == '125'
|
assert response.x == '125'
|
||||||
|
|
||||||
# def test_custom_event_loop(capability):
|
def test_custom_event_loop(capability):
|
||||||
# capnp.remove_event_loop()
|
capnp.remove_event_loop()
|
||||||
# capnp.DEFAULT_EVENT_LOOP = capnp._EventLoop()
|
capnp.DEFAULT_EVENT_LOOP = capnp._EventLoop()
|
||||||
|
|
||||||
# test_simple_rpc(capability)
|
test_simple_rpc(capability)
|
||||||
Reference in New Issue
Block a user