func (spin *Spinner) Yield() {
	if spin.count >= 100 {
		spin.count = 0
		if spin.suspendFor == 0 {
			runtime.Gosched()
		} else {
			time.Sleep(spin.suspendFor)
		}
		return  
	}
	spin.count++
}
Yield should be called in spinning loops and will assure correct
spin/wait/schedule behavior according to the set priority.
package tsync
import (
	"runtime"
	"time"
)
type Spinner struct {
	count      uint32
	suspendFor time.Duration
}
type SpinPriority uint32
const (
	SpinPrioritySuspend = SpinPriority(iota)
	SpinPriorityLow = SpinPriority(iota)
	SpinPriorityMedium = SpinPriority(iota)
	SpinPriorityHigh = SpinPriority(iota)
	SpinPriorityRealtime = SpinPriority(iota)
)
var (
	spinDelay = []time.Duration{
		time.Second,             
		100 * time.Millisecond,  
		time.Millisecond,        
		10 * time.Microsecond,   
		time.Duration(0),        
	}
)
func NewSpinner(priority SpinPriority) Spinner {
	return Spinner{
		count:      0,
		suspendFor: spinDelay[priority],
	}
}
func NewCustomSpinner(suspendFor time.Duration) Spinner {
	return Spinner{
		count:      0,
		suspendFor: suspendFor,
	}
}