From 0acff566213fdddbc8f4561887aced121f82dc26 Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Wed, 23 Apr 2014 18:12:53 -0400 Subject: future: Add a race-free way to examine a partial computation. This allows safe OpenGL previews, for example. dmnsn_future* learned the dmnsn_future_{pause,resume}() functions which cause all worker threads to block. render.test now survives Helgrind with no errors. --- libdimension-python/dimension.pyx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'libdimension-python/dimension.pyx') diff --git a/libdimension-python/dimension.pyx b/libdimension-python/dimension.pyx index a50f247..7b6619f 100644 --- a/libdimension-python/dimension.pyx +++ b/libdimension-python/dimension.pyx @@ -1,5 +1,5 @@ ######################################################################### -# Copyright (C) 2011-2012 Tavian Barnes # +# Copyright (C) 2011-2014 Tavian Barnes # # # # This file is part of The Dimension Python Module. # # # @@ -91,6 +91,12 @@ cdef class Future: with nogil: dmnsn_future_wait(self._future, progress) + def pause(self): + with nogil: + dmnsn_future_pause(self._future) + def resume(self): + dmnsn_future_resume(self._future) + # Let Futures be used as context managers def __enter__(self): return self -- cgit v1.2.3