Skip to content

Commit 15d5a63

Browse files
committed
Merge pull request astaxie#135 from xland/patch-1
Update 2.7.md
2 parents 97e45e7 + 648e31f commit 15d5a63

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

2.7.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ Goroutines是通过Go的runtime管理的一个线程管理器。Goroutines通过
4343
hello
4444

4545
我们可以看到go关键字很方便的就实现了并发编程。
46+
runtime.Gosched()表示让CPU把时间片让给别人。
4647
## channels
4748
Goroutines运行在相同的地址空间,因此访问共享内存必须做好同步。那么Goroutines之间如何进行数据的通信呢,Go提供了一个很好的通信机制channel。channel可以与Unix shell 中的双向管道做类比:可以通过它发送或者接收值。这些值只能是特定的类型:channel类型。定义一个channel 时,也需要定义发送到channel 的值的类型。注意,必须使用make 创建channel:
4849

0 commit comments

Comments
 (0)