Synchronization primitives: Channel

Channels are the simplest mechanism for 2 tasks to exchange data.

class evergreen.channel.Channel

A synchronous communication pipe between 2 tasks.

send(data)

Send data over the channel. The calling task will be blocked if there is no task waiting for the data on the other side.

send_exception(exc_type, exc_value=None, exc_tb=None)

Send the given exception. It will be raised on the receiving task.

receive()

Wait for data to arrive on the channel.

Previous topic

Task: a cooperative thread

Next topic

Synchronization primitives: Event

This Page