Documentation ¶
Index ¶
Constants ¶
View Source
const (
// LoopForever is a constant indicating that timer should loop forever
LoopForever = -1
)
Variables ¶
View Source
var ( // Manager manager for all Timers Manager = &struct { incrementID int64 // auto increment id timers sync.Map // all Timers ChClosingTimer chan int64 // timer for closing ChCreatedTimer chan *Timer }{} // Precision indicates the precision of timer, default is time.Second Precision = time.Second // GlobalTicker represents global ticker that all cron job will be executed // in globalTicker. GlobalTicker *time.Ticker )
Functions ¶
func Cron ¶
func Cron()
Cron executes scheduled tasks TODO: if closing Timers'count in single cron call more than timerBacklog will case problem.
func SetTimerBacklog ¶
func SetTimerBacklog(c int)
SetTimerBacklog set the timer created/closing channel backlog, A small backlog may cause the logic to be blocked when call NewTimer/NewCountTimer/timer.Stop in main logic gorontine.
Types ¶
type Func ¶
type Func func()
Func represents a function which will be called periodically in main logic gorontine.
Click to show internal directories.
Click to hide internal directories.