def go_channel(f, *args, **kwargs): channel = Channel(1) def done(value): if value == CLOSED: channel.close() else: # TODO: Clearly define and test the differences of # this vs. signaling closing right away (not after the # put is done) put_then_callback(channel, value, lambda ok: channel.close()) process = csp.impl.process.Process(f(*args, **kwargs), done) process.run() return channel
def go_deferred(f, *args, **kwargs): d = Deferred() process = csp.impl.process.Process(f(*args, **kwargs), d.callback) process.run() return d
def go(f, *args, **kwargs): process = csp.impl.process.Process(f(*args, **kwargs)) process.run()