Documentation
¶
Index ¶
- type State
- type ThreadState
- func (ts *ThreadState) CompareAndSwap(compareTo State, swapTo State) bool
- func (ts *ThreadState) Get() State
- func (ts *ThreadState) Is(state State) bool
- func (ts *ThreadState) IsInWaitingState() bool
- func (ts *ThreadState) MarkAsWaiting(isWaiting bool)
- func (ts *ThreadState) Name() string
- func (ts *ThreadState) RequestSafeStateChange(nextState State) bool
- func (ts *ThreadState) Set(nextState State)
- func (ts *ThreadState) SetWaitTime(t time.Time)
- func (ts *ThreadState) WaitFor(states ...State)
- func (ts *ThreadState) WaitTime() int64
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 Booting BootRequested ShuttingDown Done // these States are 'stable' and safe to transition from at any time Inactive Ready // States necessary for restarting workers Restarting Yielding // States necessary for transitioning between different handlers TransitionRequested TransitionInProgress TransitionComplete )
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
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) WaitTime ¶
func (ts *ThreadState) WaitTime() int64
WaitTime returns the time since the thread is waiting in a stable state in ms
Click to show internal directories.
Click to hide internal directories.