Atom

Workers

A worker runs on a separate native thread with its own VM. Use workers for work that can run independently, then wait for the result when you need it.

Compute a result on a worker

Start the worker with a function and one argument.

Atom
use task

func twice(value):
    return value * 2

worker = task.spawn(twice, 6)
print(task.wait(worker))
Output
12

The worker returns 12, and task.wait hands that result back to the caller.