Module

poke/process

src/poke/process.pooka

A mailbox should answer before the kettle goes cold. Channels use unique tags and selective receive: unrelated messages stay in the mailbox. A channel is owned by the process that created it. Timeouts are milliseconds and must be nonnegative. No helper guesses a waiting period.

API reference

class

Channel

src/poke/process.pooka:26
class Channel(owner: Pid, tag: Int, type_hint: Option(a))

A typed channel. Share this value with a worker; receive in its owner only.

field

owner

src/poke/process.pooka:26
owner: Pid
INFERREDPid
field

tag

src/poke/process.pooka:26
tag: Int
INFERREDInt
field

type_hint

src/poke/process.pooka:26
type_hint: Option(a)
INFERREDOption(a)
constructor

new

src/poke/process.pooka:26
INFERREDfn(Pid, Int, Option(a)) -> poke/process.Channel(a)
method

send

src/poke/process.pooka:27
send(value: a) -> Nil
INFERREDfn(a) -> Nil
method

receive

src/poke/process.pooka:31
receive(milliseconds: Int) -> Result(a, String)
INFERREDfn(Int) -> Result(a, String)
method

expect

src/poke/process.pooka:35
expect(milliseconds: Int) -> a
INFERREDfn(Int) -> a
function

channel

src/poke/process.pooka:40
channel() -> Channel(a)
INFERREDfn() -> poke/process.Channel(a)
function

within

src/poke/process.pooka:46
within(milliseconds: Int, run: fn() -> a) -> Result(a, String)
INFERREDfn(Int, fn() -> a) -> Result(a, String)

Execute in a monitored worker. A timeout kills and joins that worker.

function

with_task

src/poke/process.pooka:51
with_task(run: fn() -> Nil, use_task: fn(Pid) -> a) -> a
INFERREDfn(fn() -> Nil, fn(Pid) -> a) -> a

Own a worker for one callback. It is killed and joined when the callback ends.

function

crashes

src/poke/process.pooka:56
crashes(milliseconds: Int, run: fn() -> a) -> String
INFERREDfn(Int, fn() -> a) -> String

Expect an exception or abnormal process exit; a timeout is not a crash.

function

with_process

src/poke/process.pooka:72
with_process(pid: Pid, use_process: fn(Pid) -> a) -> a
INFERREDfn(Pid, fn(Pid) -> a) -> a

Adopt an existing actor or process for a callback, then kill and join it. Only pass processes owned by the test; shared application processes belong to their supervisor instead.