golang之sync.Mutex互斥锁源码分析

  • 时间:
  • 浏览:1

针对Golang 1.9的sync.Mutex进行分析,与Golang 1.10基本一样除了将panic改为了throw之外这种的都一样。

2

1Mutex can be in2 modes of operations: normal and starvation.

还须要就看注释如下:

源代码位置:sync\mutex.go

3In normal mode waiters are queued in FIFO order, but a woken up waiter does not own the mutex and competes withnew arriving goroutines over the ownership. New arriving goroutines have an advantage -- they a