Make pycapnp more GIL friendly (#308)

* Mark c++ capnp api with nogil

* Release gil before blocking in capnp during message reading
This commit is contained in:
Lasse Blaauwbroek
2023-03-13 17:56:02 +01:00
committed by GitHub
parent 5061cdd1ee
commit 701cabe61d
3 changed files with 210 additions and 208 deletions

View File

@@ -3822,7 +3822,8 @@ cdef class _PackedMessageReader(_MessageReader):
cdef schema_cpp.ReaderOptions opts = make_reader_opts(traversal_limit_in_words, nesting_limit)
self._parent = parent
self.thisptr = new schema_cpp.PackedMessageReader(stream, opts)
with nogil:
self.thisptr = new schema_cpp.PackedMessageReader(stream, opts)
return self
def __dealloc__(self):
@@ -3872,7 +3873,8 @@ cdef class _InputMessageReader(_MessageReader):
cdef schema_cpp.ReaderOptions opts = make_reader_opts(traversal_limit_in_words, nesting_limit)
self._parent = parent
self.thisptr = new schema_cpp.InputStreamMessageReader(stream, opts)
with nogil:
self.thisptr = new schema_cpp.InputStreamMessageReader(stream, opts)
return self
def __dealloc__(self):