tur/chan

stdlib/chan.tur
defn

chan-new

(chan-new [cap :int] :ptr<void>)

allocate a new synchronous blocking channel with the given capacity.

capring-buffer capacity (number of int64_t slots)

Since: Phase T19-C

defn

chan-send

(chan-send [ch :ptr<void> val :int] :nil)

send a value into a synchronous channel, blocking when full.

chchannel handle returned by chan-new
valint64_t value to enqueue

Since: Phase T19-C

defn

chan-recv

(chan-recv [ch :ptr<void>] :int)

receive a value from a synchronous channel, blocking when empty.

chchannel handle returned by chan-new

Since: Phase T19-C

defn

chan-free

(chan-free [ch :ptr<void>] :nil)

destroy a synchronous channel and release all associated memory.

chchannel handle returned by chan-new

Since: Phase T19-C

defn

async-chan-new

(async-chan-new [cap :int] :ptr<void>)

allocate a new async buffered channel with the given capacity.

capring-buffer capacity (number of int64_t slots)

Since: Phase T19-D

defn

async-chan-send

(async-chan-send [ch :ptr<void> val :int] :nil)

send a value into an async channel, blocking when full.

chchannel handle returned by async-chan-new
valint64_t value to enqueue

Since: Phase T19-D

defn

async-chan-recv

(async-chan-recv [ch :ptr<void>] :int)

receive a value from an async channel, blocking when empty.

chchannel handle returned by async-chan-new

Since: Phase T19-D

defn

async-chan-try-send

(async-chan-try-send [ch :ptr<void> val :int] :bool)

attempt to send a value without blocking.

chchannel handle returned by async-chan-new
valint64_t value to enqueue

Since: Phase T19-D

defn

async-chan-try-recv

(async-chan-try-recv [ch :ptr<void>] :int)

attempt to receive a value without blocking.

chchannel handle returned by async-chan-new

Since: Phase T19-D

defn

async-chan-count

(async-chan-count [ch :ptr<void>] :int)

return the number of items currently in an async channel.

chchannel handle returned by async-chan-new

Since: Phase T19-D

defn

async-chan-free

(async-chan-free [ch :ptr<void>] :nil)

destroy an async channel and release all associated memory.

chchannel handle returned by async-chan-new

Since: Phase T19-D