From a4b358fd9cc60f415ee90f6cb9cc5333cc2bf4e3 Mon Sep 17 00:00:00 2001 From: TorchedSammy <38820196+TorchedSammy@users.noreply.github.com> Date: Sat, 21 May 2022 21:39:14 -0400 Subject: [PATCH] perf: use struct{} for done channel in timer instead of bool --- timer.go | 4 ++-- timerhandler.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/timer.go b/timer.go index 481156d..af1a31e 100644 --- a/timer.go +++ b/timer.go @@ -25,7 +25,7 @@ type timer struct{ fun *rt.Closure th *timerHandler ticker *time.Ticker - channel chan bool + channel chan struct{} } func (t *timer) start() error { @@ -65,7 +65,7 @@ func (t *timer) stop() error { return errors.New("timer not running") } - t.channel <- true + t.channel <- struct{}{} t.running = false t.th.running-- diff --git a/timerhandler.go b/timerhandler.go index a85bb17..1a18edb 100644 --- a/timerhandler.go +++ b/timerhandler.go @@ -34,7 +34,7 @@ func (th *timerHandler) create(typ timerType, dur time.Duration, fun *rt.Closure typ: typ, fun: fun, dur: dur, - channel: make(chan bool, 1), + channel: make(chan struct{}, 1), th: th, id: th.latestID, }