Data and Math

vqueue

A thread safe queue, built on Venutian’s own share and protect.

Released v1.0.0 · 2026-09-28
Import
use "stdlib/queue.ven"
vqueue.ven
q = queue_new()
print queue_is_empty(q)
:: yes
Reference (6 functions)

API reference

queue_new()

Builds a new, empty, thread-safe queue handle.

q = queue_new()
print queue_is_empty(q)
:: prints: yes

queue_push(q, item)

Adds item to the back of q.

q = queue_new()
queue_push(q, "a")
print queue_length(q)
:: prints: 1

queue_try_pop(q)

Removes and gives back the front item of q without waiting.

q = queue_new()
queue_push(q, "x")
print queue_try_pop(q)
print queue_try_pop(q)
:: prints: (yes, "x")
::         (no, nothing)

queue_pop(q, timeout_seconds)

Removes and gives back the front item of q, waiting up to timeout_seconds for one to appear.

q = queue_new()
queue_push(q, "y")
print queue_pop(q, 1.0)
:: prints: y

queue_length(q)

Gives back the number of items currently in q.

q = queue_new()
queue_push(q, "a")
queue_push(q, "b")
print queue_length(q)
:: prints: 2

queue_is_empty(q)

Tests whether q currently has no items.

q = queue_new()
print queue_is_empty(q)
queue_push(q, "a")
print queue_is_empty(q)
:: prints: yes
::         no

Get notified when vqueue changes

Get notified about

New versions and security advisories.

New and updated packages, once a day.

News on the math model built in Venutian.