Data and Math
vqueue
A thread safe queue, built on Venutian’s own share and protect.
Released v1.0.0 · 2026-09-28use "stdlib/queue.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: yesqueue_push(q, item)
Adds item to the back of q.
q = queue_new()
queue_push(q, "a")
print queue_length(q)
:: prints: 1queue_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: yqueue_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: 2queue_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