No matching definitions.

arc

stdlib/arc.tur

Arc<T>, the thread-safe counterpart to rc<T>.

(let [a (arc-new 42)
        b (arc-clone a)]
    (println (arc-get b))            ; => 42
    (println (arc-strong-count a))   ; => 2
    (arc-drop b)
    (arc-drop a))

Since: 2026-08-20

defn

arc-new

(arc-new [v : int] :)

allocate an Arc holding an int payload, strong count 1.

vthe value to share

A new Arc with strong count 1 and the weak sentinel held.

(arc-get (arc-new 42))  ; => 42

Since: 2026-08-20

defn

arc-clone

(arc-clone [^borrow a : Arc] :)

add a strong reference.

athe Arc to clone (borrowed; the caller keeps its own handle)

A second Arc onto the same value. Both must be dropped.

(let [a (arc-new 1) b (arc-clone a)]
    (println (arc-strong-count a)))  ; => 2

Since: 2026-08-20

defn

arc-get

(arc-get [^borrow a : Arc] :)

read the shared value.

athe Arc to read (borrowed)

The contained value; 0 for a null handle or one already dropped.

(arc-get (arc-new 7))  ; => 7

Since: 2026-08-20

defn

arc-strong-count

(arc-strong-count [^borrow a : Arc] :)

how many Arc handles share this value.

athe Arc to inspect (borrowed)

The current strong count; 0 for a null handle.

(arc-strong-count (arc-new 1))  ; => 1

Since: 2026-08-20

defn

arc-weak-count

(arc-weak-count [^borrow a : Arc] :)

how many ArcWeak handles point at this value.

athe Arc to inspect (borrowed)

The weak count excluding the sentinel; 0 for a null handle.

(let [a (arc-new 1) w (arc-downgrade a)]
    (println (arc-weak-count a)))  ; => 1

Since: 2026-08-20

defn

arc-drop

(arc-drop [a : Arc] :)

release one strong reference.

athe Arc to release (consumed -- do not use it afterwards)
(let [a (arc-new 1)] (arc-drop a))

Since: 2026-08-20

defn

arc-downgrade

(arc-downgrade [^borrow a : Arc] :)

make a non-owning ArcWeak from an Arc.

athe Arc to downgrade (borrowed)

An ArcWeak onto the same control block. Release it with arc-weak-drop.

(let [a (arc-new 1) w (arc-downgrade a)]
    (arc-weak-drop w) (arc-drop a))

Since: 2026-08-20

defn

arc-upgrade

(arc-upgrade [^borrow w : ArcWeak] :)
defn

arc-weak-drop

(arc-weak-drop [w : ArcWeak] :)

release one weak reference.

wthe ArcWeak to release (consumed -- do not use it afterwards)
(let [a (arc-new 1) w (arc-downgrade a)]
    (arc-weak-drop w) (arc-drop a))

Since: 2026-08-20

Internal definitions
Arc
ArcWeak
arc-try-upgrade-- try to get a strong Arc back from a weak handle.
arc-weak->arc-- internal: view a weak handle as the strong one it