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

with console from std:io
with WaitGroup from std:sync

var wg = WaitGroup()

spawn({_ =>
    wg.add()
    for(_ in 0|..|11)
        console.out("Hello from the actor!")
    end
    wg.done()
})

wg.wait()

Last updated