CDE
This commit is contained in:
parent
518da4a923
commit
764da6cbbb
6144 changed files with 83610 additions and 11 deletions
25
Task/Concurrent-computing/Go/concurrent-computing-3.go
Normal file
25
Task/Concurrent-computing/Go/concurrent-computing-3.go
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
package main
|
||||
|
||||
import "fmt"
|
||||
|
||||
func main() {
|
||||
w1 := make(chan bool, 1)
|
||||
w2 := make(chan bool, 1)
|
||||
w3 := make(chan bool, 1)
|
||||
for i := 0; i < 3; i++ {
|
||||
w1 <- true
|
||||
w2 <- true
|
||||
w3 <- true
|
||||
fmt.Println()
|
||||
for i := 0; i < 3; i++ {
|
||||
select {
|
||||
case <-w1:
|
||||
fmt.Println("Enjoy")
|
||||
case <-w2:
|
||||
fmt.Println("Rosetta")
|
||||
case <-w3:
|
||||
fmt.Println("Code")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue