HadesLang Doc
Search…
Actors
Hades implements the Actor model in a very lightweight way. Every process in Hades has a state and a message queue. In Hades, one can pass messages from process to process. Processes are referenced via PIDs.
More on the actor model here.
One can create a new actor with the built-in spawn function.

Example

1
with console from std:io
2
with WaitGroup from std:sync
3
4
var wg = WaitGroup()
5
6
spawn({_ =>
7
wg.add()
8
for(_ in 0|..|11)
9
console.out("Hello from the actor!")
10
end
11
wg.done()
12
})
13
14
wg.wait()
Copied!
Last modified 2yr ago
Copy link
Contents
Example