Example #1
0
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
Example #2
0
def go_deferred(f, *args, **kwargs):
    d = Deferred()
    process = csp.impl.process.Process(f(*args, **kwargs), d.callback)
    process.run()
    return d
Example #3
0
def go(f, *args, **kwargs):
    process = csp.impl.process.Process(f(*args, **kwargs))
    process.run()