state

package
v1.14.0 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2026 License: MIT Imports: 4 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type State

type State int
const (
	// lifecycle States of a thread
	Reserved State = iota // stable
	Booting
	BootRequested
	ShuttingDown
	Done

	// these States are 'stable' and safe to transition from at any time
	Inactive // stable
	Ready    // stable

	// States necessary for transitioning between different handlers
	TransitionRequested
	TransitionInProgress
	TransitionComplete

	// thread is exiting the C loop for a full ZTS restart (max_requests)
	Rebooting
	ForceRebooting
	// C thread has exited and ZTS state is cleaned up, ready to spawn a new C thread
	RebootReady
	// all threads are yielding for main thread reboot
	YieldingForReboot
)

func (State) String added in v1.11.2

func (s State) String() string

type ThreadState

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

func NewThreadState

func NewThreadState() *ThreadState

func (*ThreadState) CompareAndSwap

func (ts *ThreadState) CompareAndSwap(compareTo State, swapTo State) bool

func (*ThreadState) Get

func (ts *ThreadState) Get() State

func (*ThreadState) Is

func (ts *ThreadState) Is(state State) bool

func (*ThreadState) IsInWaitingState

func (ts *ThreadState) IsInWaitingState() bool

IsInWaitingState returns true if a thread is waiting for a request or shutdown

func (*ThreadState) MarkAsWaiting

func (ts *ThreadState) MarkAsWaiting(isWaiting bool)

MarkAsWaiting hints that the thread reached a stable state and is waiting for requests or shutdown

func (*ThreadState) Name

func (ts *ThreadState) Name() string

func (*ThreadState) RequestSafeStateChange

func (ts *ThreadState) RequestSafeStateChange(nextState State) bool

RequestSafeStateChange safely requests a state change from a different goroutine returns false if the thread is already reserved, shutting down, or done

func (*ThreadState) Set

func (ts *ThreadState) Set(nextState State)

func (*ThreadState) SetWaitTime

func (ts *ThreadState) SetWaitTime(t time.Time)

func (*ThreadState) WaitFor

func (ts *ThreadState) WaitFor(states ...State)

WaitFor blocks until the thread reaches a certain state

func (*ThreadState) WaitForStateWithTimeout added in v1.12.5

func (ts *ThreadState) WaitForStateWithTimeout(timeout time.Duration, states ...State) bool

func (*ThreadState) WaitTime

func (ts *ThreadState) WaitTime() int64

WaitTime returns the time since the thread is waiting in a stable state in ms

Jump to

Keyboard shortcuts

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