All pastes #22023 Raw Edit

Mine

public text v1 · immutable
#22023 ·published 2005-09-03 04:13 UTC
rendered paste body
# showing who stopped the reactor

def doSomethingAndStop(name):
  reactor.callLater(0, doDeferredThing, name)

def doDeferredThing(name):
  d = What()
  d.addBoth(stopNow, name)

def stopNow(result):
  reactor.stoppedBy = result
  reactor.stop()

doSomethingAndStop("fred")
reactor.run()
print reactor.stoppedBy
doSomethingAndStop("wilma")
reactor.run()
print reactor.stoppedBy