func NewTimedSched(parallel int) *TimedSched {
	ts := new(TimedSched)
	ts.chTask = make(chan timedFunc)
	ts.die = make(chan struct{})
	ts.chPrependNotify = make(chan struct{}, 1)
	for i := 0; i < parallel; i++ {
		go ts.sched()
	}
	go ts.prepend()
	return ts
}
NewTimedSched creates a parallel-scheduler with given parallelization
package kcp
import (
	"container/heap"
	"runtime"
	"sync"
	"time"
)
var SystemTimedSched *TimedSched = NewTimedSched(runtime.NumCPU())
type timedFunc struct {
	execute func()
	ts      time.Time
}
type timedFuncHeap []timedFunc
func (h timedFuncHeap) Len() int            { return len(h) }
func (h timedFuncHeap) Less(i, j int) bool  { return h[i].ts.Before(h[j].ts) }
func (h timedFuncHeap) Swap(i, j int)       { h[i], h[j] = h[j], h[i] }
func (h *timedFuncHeap) Push(x interface{}) { *h = append(*h, x.(timedFunc)) }
func (h *timedFuncHeap) Pop() interface{} {
	old := *h
	n := len(old)
	x := old[n-1]
	old[n-1].execute = nil  
	*h = old[0 : n-1]
	return x
}
type TimedSched struct {
	prependTasks    []timedFunc
	prependLock     sync.Mutex
	chPrependNotify chan struct{}
	chTask chan timedFunc
	dieOnce sync.Once
	die     chan struct{}
}