Closed
Description
Seeing how there is a comm::select2 I think that it would be useful to have a spawn_listener2. Fwiw the use case I have in mind is a task that allows other tasks to get copies of and mutate state shared by the tasks:
fn manage_state(get_state_port: comm::port<comm::chan<str>>, set_state_port: comm::port<str>)
{
let mut state = "default";
loop
{
alt comm::select2(get_state_port, set_state_port)
{
either::left(channel)
{
comm::send(channel, copy(state));
}
either::right(new_state)
{
state = new_state;
}
}
}
}
Metadata
Metadata
Assignees
Labels
No labels