sleepct

package
v0.5.3 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SleepCT

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

SleepCT - Sleep constant time step crates a sleep based ticker. designed to maintain a consistent sleep/tick interval. The sleeper can be paused waiting to be signaled from another go routine. This allows for the pausing of loops that do not have work to complete

func (*SleepCT) Notify added in v0.5.0

func (s *SleepCT) Notify()

Notify attempts to resume a paused sleeper. It is safe to call notify from other processes and as often as desired.

func (*SleepCT) SleepNextTarget

func (s *SleepCT) SleepNextTarget(ctx context.Context, pause bool) int64

Sleep to the next target duration. If pause it set to true will sleep the duration and wait to be notified. The notification channel will be cleared when the thread wakes. SleepNextTarget should not be call more than once concurrently.

func (*SleepCT) Start

func (s *SleepCT) Start(d time.Duration)

Jump to

Keyboard shortcuts

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