summaryrefslogtreecommitdiffstats
path: root/src/util
diff options
context:
space:
mode:
Diffstat (limited to 'src/util')
-rw-r--r--src/util/eventbox.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/util/eventbox.go b/src/util/eventbox.go
index 568ad9f7..a5821eab 100644
--- a/src/util/eventbox.go
+++ b/src/util/eventbox.go
@@ -78,3 +78,18 @@ func (b *EventBox) Unwatch(events ...EventType) {
b.ignore[event] = true
}
}
+
+func (b *EventBox) WaitFor(event EventType) {
+ looping := true
+ for looping {
+ b.Wait(func(events *Events) {
+ for evt := range *events {
+ switch evt {
+ case event:
+ looping = false
+ return
+ }
+ }
+ })
+ }
+}