Documentation ¶
Index ¶
- Variables
- type Coroutines
- func (p *Coroutines) Abort()
- func (p *Coroutines) Create(tobj ThreadObj, fn func(me Thread) int) Thread
- func (p *Coroutines) CreateAndStart(start bool, tobj ThreadObj, fn func(me Thread) int) Thread
- func (p *Coroutines) Current() Thread
- func (p *Coroutines) Resume(th Thread)
- func (p *Coroutines) Sched(me Thread)
- func (p *Coroutines) Sleep(t time.Duration)
- func (p *Coroutines) StopIf(filter func(th Thread) bool)
- func (p *Coroutines) Yield(me Thread)
- type Thread
- type ThreadObj
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrCannotYieldANonrunningThread represents an "can not yield a non-running thread" error. ErrCannotYieldANonrunningThread = errors.New("can not yield a non-running thread") ErrAbortThread = errors.New("abort thread") )
Functions ¶
This section is empty.
Types ¶
type Coroutines ¶
type Coroutines struct {
// contains filtered or unexported fields
}
Coroutines represents a coroutine manager.
func (*Coroutines) Abort ¶
func (p *Coroutines) Abort()
func (*Coroutines) Create ¶
func (p *Coroutines) Create(tobj ThreadObj, fn func(me Thread) int) Thread
Create creates a new coroutine.
func (*Coroutines) CreateAndStart ¶
CreateAndStart creates and executes the new coroutine.
func (*Coroutines) Current ¶
func (p *Coroutines) Current() Thread
func (*Coroutines) Resume ¶
func (p *Coroutines) Resume(th Thread)
Resume resumes a suspended coroutine.
func (*Coroutines) Sleep ¶
func (p *Coroutines) Sleep(t time.Duration)
func (*Coroutines) StopIf ¶
func (p *Coroutines) StopIf(filter func(th Thread) bool)
func (*Coroutines) Yield ¶
func (p *Coroutines) Yield(me Thread)
Yield suspends a running coroutine.
Click to show internal directories.
Click to hide internal directories.