We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d85b3b7 commit 7f7f5edCopy full SHA for 7f7f5ed
time_wheel_node.go
@@ -52,7 +52,11 @@ type timeNode struct {
52
}
53
54
func (t *timeNode) Stop() {
55
- //这里和32行是竞争关系,拷贝一个副本,防止出现unlock unlock的情况
+ //这里为什么修改成cpyList := t.list
56
+ //如果直接使用t.list.Lock()和t.list.Unlock()就会和lockPushBack函数里的node.list = t 是竞争关系
57
+ //lockPushBack拿到锁,修改国t.list的值。这时候Stop函数里面的t.list.Lock()持有旧链表里的锁。t.list.unlock新链表里的锁,发触发unlock unlock情况。
58
+
59
+ //TODO:思考有没有新的竞争关系。。。
60
cpyList := t.list
61
cpyList.Lock()
62
defer cpyList.Unlock()
0 commit comments