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

Run the the example fail #4

Open
figureout opened this issue Dec 28, 2023 · 0 comments
Open

Run the the example fail #4

figureout opened this issue Dec 28, 2023 · 0 comments

Comments

@figureout
Copy link

i run by copy exmaple code, it print nothing.
my go version:
go version go1.21.5 linux/amd64
than i change func Read sema.Add(1) to main goroutine inside the for block it run well

···code:
userCount := 10
for i := 0; i < userCount; i++ {
fmt.Printf("go init func: %d\n",i)
sema.Add(1) // move it to here
go iRead(i)
}

does it matter to go version

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