##I have tried to fix my par function like this:
##-----------------
def par(*funcs):
taskEnd = stackless.channel()
def signalEnd(f):
f()
taskEnd.send(1)
for f in funcs:
stackless.tasklet(signalEnd)(f)
stackless.schedule()
count = len(funcs)
while count > 0:
taskEnd.receive()
count -= 1
##-----------------
##But it still crashes if one of the funcs raises an exception.
##
##I have found one way to fix it - create the taskEnd channel outside the
##function (as a global). Then it works fine, but of course the semantics
##are messed up if there is more than one par in a program.
##
def f():
1/0
par(f)