Skip to content
velt/sync/epoch exports

velt/sync/epoch

API reference

Epoch-based reclamation, written in Velt on Atomic, ThreadLocal and Mutex: a way to drop a shared value that other threads may still be reading, once none can be. The compiler calls it for the values an Atomic of a shared value replaces, and opens a section around a function that loads one. For a walkthrough, read the guide.

import { collect } from "velt/sync/epoch";

Exports

Re-exported from velt/sync/epoch/reclaim

function collect(): u64

Moves the epoch on if every thread in a section has seen the current one, then drops every value retired 2 epochs or more before, on every thread's list. Returns how many it dropped.

Re-exported from velt/sync/epoch/reclaim

function dropped(): u64

The values dropped so far, on every thread (by collect, and by retire's own collects).

Re-exported from velt/sync/epoch/reclaim

function outstanding(): u64

The values retired on every thread and not dropped yet.

Re-exported from velt/sync/epoch/reclaim

function pending(): u64

The values retired on this thread and not dropped yet.

Re-exported from velt/sync/epoch/reclaim

function pin(): void

Enters a section: until the matching unpin(), no value retired from now on is dropped, and neither is one retired before that this thread can still reach. Sections nest.

Re-exported from velt/sync/epoch/reclaim

function retire<T>(value: shared<T>): void

Drops value once no thread can still be reading it: every thread in a section now has left it. Call it for a value just taken out of where other threads find it.

Re-exported from velt/sync/epoch/reclaim

function unpin(): void

Leaves the section the last pin() entered.