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

Promises

A promise represents a piece of work that will finish at some point and produce a result (or fail). Promises are the high-level, everyday way to do concurrency in Raku: you start work, get a promise back immediately, and collect the result when you need it.

Unlike raw threads, promises are easy to combine — you can wait for several at once, or chain one onto the result of another. This section covers starting promises, awaiting their results, and putting them together.

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. Chain a promise
  2. Await many
  3. Kept or broken

Course navigation

Solution: Two threads   |   start and await