timeline

package
v0.8.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 3, 2026 License: BSD-3-Clause Imports: 2 Imported by: 0

Documentation

Overview

Package timeline is a monotonic synchronisation timeline: work is numbered 1, 2, 3, ... as it is submitted, and completing number n completes every number up to n. It is the fence model of virtio-gpu (virtio specification, device-types/gpu/description.tex: with a ring index, "fence_id acts as a sequence number on the synchronization timeline", and when it completes "the device MUST send a response for all outstanding commands with a sequence number less than or equal to fence_id"), and of WebGPU's queue (onSubmittedWorkDone resolves once all work submitted so far is done).

It has no dependency and no notion of a GPU: one implementation for any producer that numbers submissions and learns of completions in order.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Timeline

type Timeline struct {
	// contains filtered or unexported fields
}

Timeline is safe for concurrent use. The zero value is ready: nothing submitted, nothing completed.

func (*Timeline) Completed

func (t *Timeline) Completed() uint64

Completed is the highest completed number.

func (*Timeline) Fail

func (t *Timeline) Fail(err error)

Fail ends the timeline: every waiter, now and later, gets err for a number not yet completed (a lost device completes nothing more).

func (*Timeline) Next

func (t *Timeline) Next() uint64

Next numbers one more submission and returns its number.

func (*Timeline) Signal

func (t *Timeline) Signal(seq uint64)

Signal completes every number up to seq. A seq at or below Completed is ignored: completions only move forward.

func (*Timeline) Submitted

func (t *Timeline) Submitted() uint64

Submitted is the number of the last submission.

func (*Timeline) Wait

func (t *Timeline) Wait(ctx context.Context, seq uint64) error

Wait returns when seq is completed, the timeline failed, or ctx is done. It returns at once for a number already completed.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL