On Sun, Oct 9, 2011 at 2:57 PM, Dag Sverre Seljebotn <d.s.seljeb...@astro.uio.no> wrote: >>> with parallel.single(): >>> same as master, except any thread may do the execution >>> >>> An optional keyword argument 'nowait' specifies whether there will be a >>> barrier at the end. The default is to wait. > > I like > > if parallel.is_master(): > ... > explicit_barrier_somehow() # see below > > better as a Pythonization. One could easily support is_master to be used in > other contexts as well, simply by assigning a status flag in the master > block. > > Using an if-test flows much better with Python I feel, but that naturally > lead to making the barrier explicit. But I like the barrier always being > explicit, rather than having it as a predicate on all the different > constructs like in OpenMP....
Personally, I think I'd prefer find context managers as a very readable way to deal with parallelism, similar to the "threading" module: http://docs.python.org/library/threading.html#using-locks-conditions-and-semaphores-in-the-with-statement _______________________________________________ cython-devel mailing list cython-devel@python.org http://mail.python.org/mailman/listinfo/cython-devel