diff options
author | Tavian Barnes <tavianator@gmail.com> | 2011-11-03 23:32:45 -0400 |
---|---|---|
committer | Tavian Barnes <tavianator@gmail.com> | 2011-11-03 23:32:45 -0400 |
commit | e8bdfce85fbf792eaf8be47c6ecff01f99c94ee6 (patch) | |
tree | 37d588799686bde43a3d588acaa238b9b551b733 /libdimension-python/wrapper.pyx | |
parent | d952ec7ae90a85673c07a827e92f3c96a33725c1 (diff) | |
download | dimension-e8bdfce85fbf792eaf8be47c6ecff01f99c94ee6.tar.xz |
Don't hold the GIL for blocking operations.
Diffstat (limited to 'libdimension-python/wrapper.pyx')
-rw-r--r-- | libdimension-python/wrapper.pyx | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/libdimension-python/wrapper.pyx b/libdimension-python/wrapper.pyx index 738a63f..1afb0ea 100644 --- a/libdimension-python/wrapper.pyx +++ b/libdimension-python/wrapper.pyx @@ -67,8 +67,11 @@ cdef class Future: def join(self): self._assert_unfinished() + cdef int retcode try: - if dmnsn_future_join(self._future) != 0: + with nogil: + retcode = dmnsn_future_join(self._future) + if retcode != 0: raise RuntimeError("background task failed.") if self._finalizer is not None: self._finalizer() @@ -85,7 +88,8 @@ cdef class Future: def wait(self, progress): self._assert_unfinished() - dmnsn_future_wait(self._future, progress) + with nogil: + dmnsn_future_wait(self._future, progress) def _assert_unfinished(self): if self._future == NULL: |