tur/chan
chan-new
(chan-new [cap :int] :ptr<void>)
allocate a new synchronous blocking channel with the given capacity.
| cap | ring-buffer capacity (number of int64_t slots) |
Since: Phase T19-C
chan-send
(chan-send [ch :ptr<void> val :int] :nil)
send a value into a synchronous channel, blocking when full.
| ch | channel handle returned by chan-new | |
| val | int64_t value to enqueue |
Since: Phase T19-C
chan-recv
(chan-recv [ch :ptr<void>] :int)
receive a value from a synchronous channel, blocking when empty.
| ch | channel handle returned by chan-new |
Since: Phase T19-C
chan-free
(chan-free [ch :ptr<void>] :nil)
destroy a synchronous channel and release all associated memory.
| ch | channel handle returned by chan-new |
Since: Phase T19-C
async-chan-new
(async-chan-new [cap :int] :ptr<void>)
allocate a new async buffered channel with the given capacity.
| cap | ring-buffer capacity (number of int64_t slots) |
Since: Phase T19-D
async-chan-send
(async-chan-send [ch :ptr<void> val :int] :nil)
send a value into an async channel, blocking when full.
| ch | channel handle returned by async-chan-new | |
| val | int64_t value to enqueue |
Since: Phase T19-D
async-chan-recv
(async-chan-recv [ch :ptr<void>] :int)
receive a value from an async channel, blocking when empty.
| ch | channel handle returned by async-chan-new |
Since: Phase T19-D
async-chan-try-send
(async-chan-try-send [ch :ptr<void> val :int] :bool)
attempt to send a value without blocking.
| ch | channel handle returned by async-chan-new | |
| val | int64_t value to enqueue |
Since: Phase T19-D
async-chan-try-recv
(async-chan-try-recv [ch :ptr<void>] :int)
attempt to receive a value without blocking.
| ch | channel handle returned by async-chan-new |
Since: Phase T19-D
async-chan-count
(async-chan-count [ch :ptr<void>] :int)
return the number of items currently in an async channel.
| ch | channel handle returned by async-chan-new |
Since: Phase T19-D
async-chan-free
(async-chan-free [ch :ptr<void>] :nil)
destroy an async channel and release all associated memory.
| ch | channel handle returned by async-chan-new |
Since: Phase T19-D