mirror of
https://github.com/savoirfairelinux/opendht.git
synced 2026-11-08 04:21:51 +00:00
python: release GIL while joining and destroying runners
This commit is contained in:
1 parent
26488d18a6
commit
601a8fbf80
2 files changed
+6
-2
No files matched your search
+5
-1
@@ -652,6 +652,9 @@ cdef class DhtRunner(_WithID):
|
||||
cdef cpp.shared_ptr[cpp.DhtRunner] thisptr
|
||||
def __cinit__(self):
|
||||
self.thisptr.reset(new cpp.DhtRunner())
|
||||
def __dealloc__(self):
|
||||
with nogil:
|
||||
self.thisptr.reset()
|
||||
def getId(self) -> InfoHash:
|
||||
h = InfoHash()
|
||||
if self.thisptr:
|
||||
@@ -706,7 +709,8 @@ cdef class DhtRunner(_WithID):
|
||||
else:
|
||||
self.thisptr.get().run(port, run_config)
|
||||
def join(self):
|
||||
self.thisptr.get().join()
|
||||
with nogil:
|
||||
self.thisptr.get().join()
|
||||
def shutdown(self, shutdown_cb=None):
|
||||
cb_obj = {'shutdown':shutdown_cb}
|
||||
ref.Py_INCREF(cb_obj)
|
||||
|
||||
@@ -297,7 +297,7 @@ cdef extern from "opendht/dhtrunner.h" namespace "dht":
|
||||
void bootstrap(const SockAddr&, DoneCallbackSimple done_cb)
|
||||
void run(in_port_t, Config config)
|
||||
void run(const_char*, const_char*, const_char*, Config config)
|
||||
void join()
|
||||
void join() except + nogil
|
||||
void shutdown(ShutdownCallback)
|
||||
void registerType(ValueType& value);
|
||||
bool isRunning()
|
||||
|
||||
Reference in new issue
Block a user