concurrent goroutines
This commit is contained in:
12
gobyexample/channel-buffering.go
Normal file
12
gobyexample/channel-buffering.go
Normal file
@ -0,0 +1,12 @@
|
||||
package main
|
||||
|
||||
import "fmt"
|
||||
|
||||
func main() {
|
||||
messages := make(chan string, 2)
|
||||
messages <- "buffered"
|
||||
messages <- "channel"
|
||||
|
||||
fmt.Println(<-messages)
|
||||
fmt.Println(<-messages)
|
||||
}
|
Reference in New Issue
Block a user