Exemple #1
0
func main() {
	/*ch := make(chan int)
	go Walk(tree.New(1), ch)
	for i:= 0; i < 10; i++ {
		fmt.Print(<-ch, " ")
	}*/
	fmt.Println(Same(tree.New(2), tree.New(2)))
}
Exemple #2
0
func main() {
	runtime.GOMAXPROCS(2) // 最多使用2个核

	fmt.Println(runtime.NumCPU())
	ch1 := make(chan int)
	ch2 := make(chan int)
	go Walk(tree.New(1), ch1)
	go Walk(tree.New(2), ch2)

	for i := range ch1 {
		fmt.Sprint(i)
	}

	for i := range ch2 {
		fmt.Sprint(i)
	}

	//Same(tree.New(2), tree.New(2))
	//Same(tree.New(2), tree.New(3))
}