summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libdimension-python/wrapper.pxd4
-rw-r--r--libdimension-python/wrapper.pyx8
2 files changed, 8 insertions, 4 deletions
diff --git a/libdimension-python/wrapper.pxd b/libdimension-python/wrapper.pxd
index 7ba17e9..2526022 100644
--- a/libdimension-python/wrapper.pxd
+++ b/libdimension-python/wrapper.pxd
@@ -70,10 +70,10 @@ cdef extern from "../libdimension/dimension.h":
ctypedef struct dmnsn_future
- int dmnsn_future_join(dmnsn_future *future)
+ int dmnsn_future_join(dmnsn_future *future) nogil
void dmnsn_future_cancel(dmnsn_future *future)
double dmnsn_future_progress(dmnsn_future *future)
- void dmnsn_future_wait(dmnsn_future *future, double progress)
+ void dmnsn_future_wait(dmnsn_future *future, double progress) nogil
##########
# Timers #
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: