(f func() func())
| 29 | } |
| 30 | |
| 31 | func (self *AsyncHandler) Do(f func() func()) { |
| 32 | self.mutex.Lock() |
| 33 | self.currentId++ |
| 34 | id := self.currentId |
| 35 | self.mutex.Unlock() |
| 36 | |
| 37 | self.onWorker(func(gocui.Task) error { |
| 38 | after := f() |
| 39 | self.handle(after, id) |
| 40 | return nil |
| 41 | }) |
| 42 | } |
| 43 | |
| 44 | // f here is expected to be a function that doesn't take long to run |
| 45 | func (self *AsyncHandler) handle(f func(), id int) { |