Generate numpy matrices from slices.
[lightning.git] / throttle.go
index 1c7230f738853d3683aa652bc10a3ea5af1b0f6f..ce3279dd3398d76886c9f40cb2c279114d08d205 100644 (file)
@@ -44,3 +44,15 @@ func (t *throttle) Wait() error {
        t.wg.Wait()
        return t.Err()
 }
+
+func (t *throttle) Go(f func() error) error {
+       t.Acquire()
+       if t.Err() != nil {
+               return t.Err()
+       }
+       go func() {
+               t.Report(f())
+               t.Release()
+       }()
+       return nil
+}