[Stackless] Fixed PAR

Tom Locke tom at livelogix.com
Thu Jan 8 09:31:26 CET 2004


Finally got my par func to survive when a process raises an exception:

def signalEnd(f, chan):
    f()
    taskEnd.send(1)

def par(*funcs):
    taskEnd = stackless.channel()

    for f in funcs:
        stackless.tasklet(signalEnd)(f, taskEnd)

    stackless.schedule()
    
    count = len(funcs)
    while count > 0:
        taskEnd.receive()
        t.receive()
        count -= 1

I had to move the signalEnd function out to a toplevel function. If you
move it inside par as a nested function, you're back to python crashing
when an exception happens.

Tom.


_______________________________________________
Stackless mailing list
Stackless at stackless.com
http://www.stackless.com/mailman/listinfo/stackless



More information about the Stackless mailing list