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 string
const ( // livecycle States of a thread Reserved State = "reserved" Booting State = "booting" BootRequested State = "boot requested" ShuttingDown State = "shutting down" Done State = "done" // these States are 'stable' and safe to transition from at any time Inactive State = "inactive" Ready State = "ready" // States necessary for restarting workers Restarting State = "restarting" Yielding State = "yielding" // States necessary for transitioning between different handlers TransitionRequested State = "transition requested" TransitionInProgress State = "transition in progress" TransitionComplete State = "transition complete" )
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
safely request 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)
block 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.