deadline

package
v0.0.12 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Timer

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

Timer manages a lazily-created, resettable one-shot deadline timer.

The timer is allocated only while active. Stop clears the timer reference so the runtime can recover it when no deadline is active.

func (*Timer) C

func (t *Timer) C() <-chan time.Time

C returns the timer channel while active.

A nil channel is ignored by select, which lets callers keep one simple select regardless of whether a deadline is active.

func (*Timer) Reset

func (t *Timer) Reset(d time.Duration)

Reset arms the timer to fire after d.

func (*Timer) ResetAt

func (t *Timer) ResetAt(deadline time.Time)

ResetAt arms the timer to fire at deadline.

func (*Timer) Stop

func (t *Timer) Stop()

Stop disarms the timer and releases the timer reference.

func (*Timer) Sync

func (t *Timer) Sync(deadline time.Time, active bool)

Sync arms the timer for deadline when active is true, or stops it otherwise.

Jump to

Keyboard shortcuts

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