fuzion-lang.dev — The Fuzion Language Portal
JavaScript seems to be disabled. Functionality is limited.

Idiom # 352 Parallelize 3 computations

See programming-idioms.org:

Code

concur.thread_pool creates a pool of threads and instates it as an effect. So the passed code can use concur.thread_pool.env.submit to hand a task to the pool. Since submit returns a concur.Future immediately, the three tasks run concurrently. Call get on a future to block until the result is ready.

The pool shuts down automatically when the code passed to concur.thread_pool returns. The operation returns an outcome, which contains an error if the pool fails to create.

Runnable Example

The execution order of the tasks is undefined, but their results are assigned in a fixed order. As a result, the output is identical on every run.

last changed: 2026-10-14