func (sched0 *sched[R, T]) Pause() {
	atomic.AddUint64(&sched0.pausing, 1)
	sched0.pause()
}
Pause stops the sched timing
package sched
import (
	"fmt"
	"sync"
	"time"
	"container/heap"
	"context"
	"runtime"
	"sync/atomic"
	"unsafe"
)
type Future [R any] struct {
	Err error
	value atomic.Value
}
func (f *Future[R]) Get() R {
	var v interface{}
	for ; v == nil && f.Err == nil; v = f.value.Load() {
		runtime.Gosched()
	}
	return v.(R)
}
func (f *Future[R]) put(v R) {
	f.value.Store(v)
}
type Task [R any] interface {
	GetID() (id string)
	GetExecution() (execute time.Time)
	GetRetryTime() (execute time.Time)
	Execute() (result R, retry bool, fail error)
}
type sched [R any, T Task[R]] struct {
	running uint64  
	pausing uint64  
	timer unsafe.Pointer  
	cancel atomic.Value  
	tasks *taskQueue[R]
}
func NewSched[R any, T Task[R]]() *sched[R, T] {
	return &sched[R, T]{
		timer: unsafe.Pointer(time.NewTimer(0)),
		tasks: newTaskQueue[R](),
	}
}
func (sched0 *sched[R, T]) Stop() {
	sched0.Pause()
	for atomic.LoadUint64(&sched0.running) > 0 {
		runtime.Gosched()
	}
	atomic.AddUint64(&sched0.pausing, ^uint64(0))
}
func (sched0 *sched[R, T]) Wait() {
	for sched0.tasks.length() != 0 {
		runtime.Gosched()
	}
}
func (sched0 *sched[R, T]) Submit(t T) *Future[R] {
	return sched0.schedule(t, t.GetExecution())
}
func (sched0 *sched[R, T]) Trigger(t T) *Future[R] {
	return sched0.schedule(t, time.Now())
}