File tree Expand file tree Collapse file tree 2 files changed +3
-3
lines changed
Expand file tree Collapse file tree 2 files changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -1217,8 +1217,9 @@ async fn sleep(dur: sleepDuration) {
12171217 mut c := m.c
12181218 when := nanotime() + dur
12191219 mut t := timer.new(when, nil, uintptr(&c), 0)
1220+ m.pp.timers.mu.lock()
12201221 m.pp.timers.push(t)
1221- park(&c, 0 , reasonSleep).await
1222+ park(&c, uintptr(&m.pp.timers.mu) , reasonSleep).await
12221223}
12231224
12241225// Destroys all retired coroutine frames for the current worker thread.
Original file line number Diff line number Diff line change @@ -94,14 +94,13 @@ impl timerheap {
9494 }
9595
9696 // Inserts a timer into the heap.
97+ // Timer lock must be held.
9798 #disable nilptr
9899 fn push(mut *self, mut t: &timer) {
99- t.mu.lock()
100100 t.theap = unsafe { (&timerheap)(self) }
101101 t.index = len(self.data)
102102 self.data = append(self.data, t)
103103 self.siftup(t.index)
104- t.mu.unlock()
105104 }
106105
107106 // Removes and returns the earliest timer.
You can’t perform that action at this time.
0 commit comments