Skip to content

Commit 7f7f5ed

Browse files
authored
更新注释。。。
1 parent d85b3b7 commit 7f7f5ed

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

time_wheel_node.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,11 @@ type timeNode struct {
5252
}
5353

5454
func (t *timeNode) Stop() {
55-
//这里和32行是竞争关系,拷贝一个副本,防止出现unlock unlock的情况
55+
//这里为什么修改成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:思考有没有新的竞争关系。。。
5660
cpyList := t.list
5761
cpyList.Lock()
5862
defer cpyList.Unlock()

0 commit comments

Comments
 (0)