save an import
This commit is contained in:
parent
7011383887
commit
6f45d7d219
@ -1,6 +1,6 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import ("fmt"; "time")
|
import "time"
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
jobs := make(chan int, 100)
|
jobs := make(chan int, 100)
|
||||||
@ -9,7 +9,7 @@ func main() {
|
|||||||
for w := 0; w < 10; w++ {
|
for w := 0; w < 10; w++ {
|
||||||
go func() {
|
go func() {
|
||||||
for j := range jobs {
|
for j := range jobs {
|
||||||
fmt.Println("worker", w, "processing job", j)
|
println("worker", w, "processing job", j)
|
||||||
time.Sleep(time.Millisecond * 150)
|
time.Sleep(time.Millisecond * 150)
|
||||||
acks <- true
|
acks <- true
|
||||||
}
|
}
|
||||||
@ -23,5 +23,5 @@ func main() {
|
|||||||
for a := 0; a < 100; a++ {
|
for a := 0; a < 100; a++ {
|
||||||
<- acks
|
<- acks
|
||||||
}
|
}
|
||||||
fmt.Println("all done")
|
println("all done")
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user