Course of Raku / Functional, concurrent, reactive, and web programming / Concurrent programming

Channels

A channel is a thread-safe queue: one part of a program puts values in, another takes them out, and Raku handles all the locking for you. Channels are the standard way to pass a stream of values safely between concurrent tasks — a producer and a consumer.

This section shows how to send and receive values through a channel, and how closing a channel signals that no more values are coming.

Topics in this section

Practice

Complete the quizzes that cover the contents of this section.

Exercises

This section contains 3 exercises. Examine all the topics of this section before doing the coding practice.

  1. Receive a value
  2. Sum a channel
  3. Drain a channel

Course navigation

Solution: Kept or broken   |   Sending and receiving