Sha256: f9d76106ad13bb14212dd876c4b47c5981c55d60b631cd8830392f994bb57a2e
Contents?: true
Size: 474 Bytes
Versions: 15
Compression:
Stored size: 474 Bytes
Contents
package main import ( "fmt" "runtime" ) func producer(c chan int, N int, s chan bool) { for i := 0; i < N; i++ { fmt.Printf("producer: %d\n", i) c <- i } s <- true } func consumer(c chan int, N int, s chan bool) { for i := 0; i < N; i++ { fmt.Printf("consumer got: %d\n", <- c) } s <- true } func main() { runtime.GOMAXPROCS(2) c := make(chan int) s := make(chan bool) go producer(c, 10, s) go consumer(c, 10, s) <- s <- s }
Version data entries
15 entries across 15 versions & 2 rubygems