idlestrategy

package
v0.0.0-...-f6902ab Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2023 License: Apache-2.0 Imports: 3 Imported by: 19

Documentation

Index

Constants

View Source
const DefaultMaxParkNs = int64(1 * time.Millisecond)

DefaultMaxParkNs is the default interval the strategy will park the thread will expand interval to as a max.

View Source
const DefaultMaxSpins = 10

DefaultMaxSpins is the default number of times the strategy will spin without work before going to next state.

View Source
const DefaultMaxYields = 20

DefaultMaxYields is the default number of times the strategy will yield without work before going to next state.

View Source
const DefaultMinParkNs = 1000

DefaultMinParkNs is the default interval the strategy will park the thread on entering the park state.

Variables

This section is empty.

Functions

This section is empty.

Types

type BackoffIdleStrategy

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

BackoffIdleStrategy is an idling strategy for threads when they have no work to do. Spin for maxSpins, then yield with runtime.Gosched for maxYields, then park with time.Sleep on an exponential backoff to maxParkPeriodNs.

func NewBackoffIdleStrategy

func NewBackoffIdleStrategy(maxSpins, maxYields, minParkPeriodNs, maxParkPeriodNs int64) *BackoffIdleStrategy

NewBackoffIdleStrategy returns a BackoffIdleStrategy with the given parameters.

func NewDefaultBackoffIdleStrategy

func NewDefaultBackoffIdleStrategy() *BackoffIdleStrategy

NewDefaultBackoffIdleStrategy returns a BackoffIdleStrategy using DefaultMaxSpins, DefaultMaxYields, DefaultMinParkNs, and DefaultMaxParkNs.

func (*BackoffIdleStrategy) Idle

func (s *BackoffIdleStrategy) Idle(workCount int)

func (*BackoffIdleStrategy) String

func (s *BackoffIdleStrategy) String() string

type Busy

type Busy struct {
}

func (Busy) Idle

func (s Busy) Idle(fragmentsRead int)

type Idler

type Idler interface {
	Idle(fragmentsRead int)
}

type Sleeping

type Sleeping struct {
	SleepFor time.Duration
}

func (Sleeping) Idle

func (s Sleeping) Idle(fragmentsRead int)

type Yielding

type Yielding struct {
}

func (Yielding) Idle

func (s Yielding) Idle(fragmentsRead int)

Jump to

Keyboard shortcuts

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