Wait blocks the goroutine until signaled
(callback func(*Events))
| 25 | |
| 26 | // Wait blocks the goroutine until signaled |
| 27 | func (b *EventBox) Wait(callback func(*Events)) { |
| 28 | b.cond.L.Lock() |
| 29 | |
| 30 | if len(b.events) == 0 { |
| 31 | b.cond.Wait() |
| 32 | } |
| 33 | |
| 34 | callback(&b.events) |
| 35 | b.cond.L.Unlock() |
| 36 | } |
| 37 | |
| 38 | // Set turns on the event type on the box |
| 39 | func (b *EventBox) Set(event EventType, value any) { |
no outgoing calls