Skip to content

Commit

Permalink
Update 10.5.1.md
Browse files Browse the repository at this point in the history
  • Loading branch information
hantmac committed Apr 13, 2019
1 parent 67c1ee5 commit 130e392
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions eBook/chapter10/10.5.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

![""](https://github.com/hantmac/Mastering_Go_ZH_CN/tree/master/images/chapter10/10.5.1-1.jpg)

`sync.Mutex` 类型的定义没有什么特别的。所有有趣的工作都是由 `sync.Lock()``sync.Unlock()` 来做的,它们分别能加锁和解锁 `sync.Mutex` 互斥体。给互斥体上锁意味着没人可以再锁它,直到使用 `sync.Unlock()` 函数解锁。
`sync.Mutex` 类型的定义没有什么特别的。所有的工作都是由 `sync.Lock()``sync.Unlock()` 来做的,它们分别能加锁和解锁 `sync.Mutex` 互斥体。给互斥体上锁意味着没人可以操作它,直到使用 `sync.Unlock()` 函数解锁。

`mutex.go` 程序分为五部分介绍,来说明 `sync.Mutex` 类型的使用。

Expand Down Expand Up @@ -99,4 +99,4 @@ func main() {

![""](https://github.com/hantmac/Mastering_Go_ZH_CN/tree/master/images/chapter10/10.5.1-3.jpg)

输出中发生改变的原因是所有 goroutines 同时趣修改共享变量,这也是输出出现随机生成的主要原因
输出中发生改变的原因是所有 goroutines 同时去修改共享变量,这也是随机输出的主要原因

0 comments on commit 130e392

Please sign in to comment.