我是Go语言的新手,并且对并发一章中的"The little Go book"一书进行了一些练习。我无法确定删除time.Sleep(time.Millisecond * 50)
会发生什么,该 package main
import (
"fmt"
"math/rand"
"time"
)
func main() {
c := make(chan int)
for i := 0; i < 5; i++ {
worker := &Worker{id: i}
go worker.process(c)
}
for {
c <- rand.Int()
time.Sleep(time.Millisecond * 50) // ???
}
}
type Worker struct {
id int
}
func (w *Worker) process(c chan int) {
for {
data := <-c
fmt.Printf("worker %d got %d\n", w.id, data)
}
}
将输出更改为仅打印“工人4”的结果。
SELECT DPGift.Gift
,DP.Narrative
FROM DPGift
LEFT OUTER JOIN DP
ON DPGift.<ID Field> = DP.<ID Field>
AND DP.Narrative LIKE '%Verified%'