Removed old signals

This commit is contained in:
Mathias Hall-Andersen
2018-05-05 04:15:07 +02:00
parent 4d9f3a2f53
commit 7a83f2565a
7 changed files with 74 additions and 114 deletions

View File

@@ -29,11 +29,10 @@ func (e *Event) Clear() {
}
func (e *Event) Fire() {
if e == nil || atomic.SwapInt32(&e.guard, 1) != 0 {
if atomic.SwapInt32(&e.guard, 1) != 0 {
return
}
now := time.Now()
if e.next.After(now) {
if now := time.Now(); now.After(e.next) {
select {
case e.C <- struct{}{}:
default: