All pastes #823462 Raw Edit

Miscellany

public text v1 · immutable
·published 2007-12-19 11:51 UTC
rendered paste body
class RespawningProtocol:

    def __init__(self, *args):
        self.args = args

    def spawn(self):
        reactor.spawnProcess(self, self.args...)

    def processEnded(self, reason):
        self.spawn()


class XYZProcessProtocol(RespawningProtocol):
    # do whatrever


myProcesses = [
    XYZProcessProtocol('sleep', '10')
    ]

if __name__ == '__main__':
    for process in myProcesses:
        process.spawn()
    reactor.run()