Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possible modification to Goal #1 Example #147

Open
juroberttyb opened this issue Dec 19, 2024 · 0 comments
Open

Possible modification to Goal #1 Example #147

juroberttyb opened this issue Dec 19, 2024 · 0 comments

Comments

@juroberttyb
Copy link

Just wondering, for Goal #1 in Readme, the 2nd approach seems to remove the required modification in startTheThing which receives conc.WaitGroup as function parameter, would that make it look simpler for adopting conc lib?

I misunderstood it on the first glance.

  • 1st (original one)
func main() {
    var wg conc.WaitGroup
    defer wg.Wait()

    startTheThing(&wg)
}

func startTheThing(wg *conc.WaitGroup) {
    wg.Go(func() { ... })
}
  • 2nd
func main() {
    var wg conc.WaitGroup
    defer wg.Wait()

    func(wg *conc.WaitGroup) {
        wg.Go(startTheThing(...))
    }(&wg)
}

func startTheThing() {
    ...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant