under-the-hood icon indicating copy to clipboard operation
under-the-hood copied to clipboard

关于mutex的疑问

Open cuglaiyp opened this issue 3 years ago • 1 comments

问题描述

在5.3 mutex一节中,开头有这么一句话

在正常模式中,等待者按照 FIFO 的顺序排队获取锁

我注意到这个是官方注释 在下文的unlockSlow方法中,正常唤醒逻辑的代码是runtime_Semrelease(&m.sema, false, 1),您的注释是

唤醒一个阻塞的 goroutine,但不是唤醒第一个等待者

这两个说法是不是冲突了?

cuglaiyp avatar Jul 02 '21 01:07 cuglaiyp

抱歉回复晚了, 刚才看了一下, 这个注释确实是有问题的.

changkun avatar Jul 15 '21 12:07 changkun