Documentation ¶
Overview ¶
Package schedgroup provides a goroutine worker pool which schedules tasks to be performed at or after a specified time.
Special thanks to Egon Elbre from #performance on Gophers Slack for two prototypes (https://play.golang.org/p/YyeSWuDil-b, https://play.golang.org/p/4iYBO6Cgj8m) of this idea, based on Go's container/heap package. Egon's prototypes heavily influenced the final design of this package.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Group ¶
type Group struct {
// contains filtered or unexported fields
}
A Group is a goroutine worker pool which schedules tasks to be performed after a specified time. A Group must be created with the New constructor.
func New ¶
New creates a new Group which will use ctx for cancelation. If cancelation is not a concern, use context.Background().
func (*Group) Delay ¶
Delay schedules a function to run at or after the specified delay. Delay is a convenience wrapper for Schedule which adds delay to the current time. Specifying a negative delay will cause the task to be scheduled immediately.
If Delay is called after a call to Wait, Delay will panic.