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

Two threads

Problem

Start two threads. Each one computes a value and stores it in a shared variable — the first computes 10 * 10, the second 20 * 20. Join both threads, and only then add the two results together and print the sum.

Example

The program prints:

500

Solution

See the solution

Course navigation

Solution: Join and wait   |   Solution: Two threads