chore: add callback for task

This commit is contained in:
Noah Hsu
2022-06-20 17:13:19 +08:00
parent d665cce739
commit 31ff31d3dd
4 changed files with 21 additions and 8 deletions

View File

@ -13,8 +13,8 @@ type Manager struct {
tasks generic_sync.MapOf[uint64, *Task]
}
func (tm *Manager) Submit(name string, f Func) uint64 {
task := newTask(name, f)
func (tm *Manager) Submit(name string, f Func, callbacks ...Callback) uint64 {
task := newTask(name, f, callbacks...)
tm.addTask(task)
tm.do(task.ID)
return task.ID