Skip to content

Commit

Permalink
Merge pull request #10 from madflojo/stop-del-race
Browse files Browse the repository at this point in the history
Copying Map
  • Loading branch information
madflojo authored May 31, 2022
2 parents 13e623f + fe51428 commit 0459763
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion tasks.go
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,11 @@ func (schd *Scheduler) Lookup(name string) (*Task, error) {
func (schd *Scheduler) Tasks() map[string]*Task {
schd.RLock()
defer schd.RUnlock()
return schd.tasks
m := make(map[string]*Task)
for k, v := range schd.tasks {
m[k] = v
}
return m
}

// Stop is used to unschedule and delete all tasks owned by the scheduler instance.
Expand Down

0 comments on commit 0459763

Please sign in to comment.