// for this lock, chained through m->nextwaitm.
// Queue this M.
for {
- gp.m.nextwaitm = (*m)((unsafe.Pointer)(v &^ locked))
+ gp.m.nextwaitm = v &^ locked
if casuintptr(&l.key, v, uintptr(unsafe.Pointer(gp.m))|locked) {
break
}
}
}
+//go:nowritebarrier
+// We might not be holding a p in this code.
func unlock(l *mutex) {
gp := getg()
var mp *m
// Other M's are waiting for the lock.
// Dequeue an M.
mp = (*m)((unsafe.Pointer)(v &^ locked))
- if casuintptr(&l.key, v, uintptr(unsafe.Pointer(mp.nextwaitm))) {
+ if casuintptr(&l.key, v, mp.nextwaitm) {
// Dequeued an M. Wake it.
semawakeup(mp)
break
freghi [16]uint32 // d[i] msb and f[i+16]
fflag uint32 // floating point compare flags
locked uint32 // tracking for lockosthread
- nextwaitm *m // next m waiting for lock
+ nextwaitm uintptr // next m waiting for lock
waitsema uintptr // semaphore for parking on locks
waitsemacount uint32
waitsemalock uint32