goodtimer icon indicating copy to clipboard operation
goodtimer copied to clipboard

Using GoodTimer in a select?

Open barrettj12 opened this issue 1 year ago • 0 comments

This library seems great (I'm sick of the confusing time.Timer API), but reading the Godoc, it doesn't seem possible to wait on this timer in a select statement. Something like

gt := goodtimer.New(2 * time.Second)

select {
  case <-workDone:
  case <-gt.Expired():
    fmt.Println("timeout completing work")
}

barrettj12 avatar Aug 18 '23 03:08 barrettj12