Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package main
- import (
- "fmt" // output formatter
- "runtime"
- )
- func runner(id int, ch chan string){
- for i := 0; i < 50; i++{
- ch <- fmt.Sprint(id) + " " + fmt.Sprint(i) + "\n"
- }
- }
- func main() {
- runtime.GOMAXPROCS(11)
- ch := make(chan string)
- go runner(1, ch)
- go runner(2, ch)
- go runner(3, ch)
- go runner(4, ch)
- go runner(5, ch)
- for i := 0; i < 250 ; i++ {
- fmt.Printf(<- ch)
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement