I'm tying to execute things async with multiple go routines. I pass in the number of "threads" to use to process.
func refresh() {
sign := make(chan int, len(allSets))
for _, set := range allSets {
i := int(set.GetId())
if statement {
// Update
go UpdateKeywordSearcher(i, sign)
}
}
// for this part, I wanna call some func after above all for..loop UpdateKeywordSearcher done
// call anotherFunc()
}
func UpdateKeywordSearcher(setid int, sign chan int) {
// do some update logic
sign <- setid
}
as above written codes, how can I call another method after all multiple go routine finished? I searched for select but don't know what exactly I should write.