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

fixed go.go to properly select over channels during the put operation in select_both #697

Merged
merged 2 commits into from
May 19, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions crossbeam-channel/benchmarks/go.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,16 +136,21 @@ func select_both(cap int) {
var c3 = make(chan Message, cap)
var done = make(chan bool)

var producer = func(c chan Message) {
var producer = func(c0 chan Message, c1 chan Message, c2 chan Message, c3 chan Message) {
for i := 0; i < MESSAGES / THREADS; i++ {
c <- Message(i)
select {
case c0 <- Message(i):
case c1 <- Message(i):
case c2 <- Message(i):
case c3 <- Message(i):
}
}
done <- true
}
go producer(c0)
go producer(c1)
go producer(c2)
go producer(c3)
go producer(c0,c1,c2,c3)
go producer(c0,c1,c2,c3)
go producer(c0,c1,c2,c3)
go producer(c0,c1,c2,c3)

for t := 0; t < THREADS; t++ {
go func() {
Expand Down