select

command
v0.28.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 21, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Select statement is another way to handle multiple channels. It's like switch but each case is a communication.

  • All channels are evaluated.
  • Blocks until one communication can proceed.
  • If multiple can proceed, chooses (pseudo-)randomly.
  • A default case, if present, executes immediately if no channel is ready.

Timeout the conversation when no one speaks for 800 ms.

Level: intermediate Topics: select, timeout, fan-in

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL