@channels
Import this module with import @channels.
Message passing between threads. Compiler-only feature; requires POSIX threads.
| Function | Signature | Description |
|---|---|---|
open |
(capacity i64) -> Channel |
Create a buffered channel |
send |
(ch Channel, value i64) |
Send an i64 value into a channel |
receive |
(ch Channel) -> i64 |
Receive an i64 value from a channel (blocks if empty) |
close |
(ch Channel) |
Close a channel |
try_send |
(ch Channel, value i64) -> bool |
Non-blocking send; returns false if full |
try_receive |
(ch Channel) -> (i64, bool) |
Non-blocking receive; returns value and success |
Channels are i64-only. Sending non-i64 types (string, f64, bool, etc.) is a compile-time error.