Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Timer ¶
type Timer[T any] struct { C chan T // contains filtered or unexported fields }
Timer sends payload to its chan after a delay. One can schedule several events, but only one real timer will be used. It is safe to use a Timer object concurrently. Timer may drop messages, if the reader does not read fast enough, so it's important to choose a correct chan capacity.
func NewWithCapacity ¶
NewWithCapacity returns a timer for given capacity.
func (*Timer[T]) Schedule ¶
Schedule schedules a timer to fire after the delay. The payload will be sent to C.
func (*Timer[T]) ScheduleAt ¶
ScheduleAt schedules a timer to fire at the specific moment. The payload will be sent to C.
Click to show internal directories.
Click to hide internal directories.