Module
poke/process
src/poke/process.pookaA 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(owner: Pid, tag: Int, type_hint: Option(a))
A typed channel. Share this value with a worker; receive in its owner only.
owner: Pid
Pidtag: Int
Inttype_hint: Option(a)
Option(a)
fn(Pid, Int, Option(a)) -> poke/process.Channel(a)send(value: a) -> Nil
fn(a) -> Nilreceive(milliseconds: Int) -> Result(a, String)
fn(Int) -> Result(a, String)expect(milliseconds: Int) -> a
fn(Int) -> achannel() -> Channel(a)
fn() -> poke/process.Channel(a)within(milliseconds: Int, run: fn() -> a) -> Result(a, String)
fn(Int, fn() -> a) -> Result(a, String)Execute in a monitored worker. A timeout kills and joins that worker.
with_task(run: fn() -> Nil, use_task: fn(Pid) -> a) -> a
fn(fn() -> Nil, fn(Pid) -> a) -> aOwn a worker for one callback. It is killed and joined when the callback ends.
crashes(milliseconds: Int, run: fn() -> a) -> String
fn(Int, fn() -> a) -> StringExpect an exception or abnormal process exit; a timeout is not a crash.
with_process(pid: Pid, use_process: fn(Pid) -> a) -> a
fn(Pid, fn(Pid) -> a) -> aAdopt 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.