runtime: rename Lock to Mutex
Mutex is consistent with package sync, and when in the
unexported Go form it avoids having a conflcit between
the type (now mutex) and the function (lock).
LGTM=iant
R=golang-codereviews, iant
CC=dvyukov, golang-codereviews, r
https://golang.org/cl/133140043
diff --git a/src/pkg/runtime/time.go b/src/pkg/runtime/time.go
index b40952e..102539b 100644
--- a/src/pkg/runtime/time.go
+++ b/src/pkg/runtime/time.go
@@ -25,7 +25,7 @@
}
var timers struct {
- lock lock
+ lock mutex
gp *g
created bool
sleeping bool
@@ -52,7 +52,7 @@
t.when = nanotime() + ns
t.f = goroutineReady
t.arg = getg()
- golock(&timers.lock)
+ lock(&timers.lock)
addtimerLocked(t)
goparkunlock(&timers.lock, "sleep")
}
@@ -79,9 +79,9 @@
}
func addtimer(t *timer) {
- golock(&timers.lock)
+ lock(&timers.lock)
addtimerLocked(t)
- gounlock(&timers.lock)
+ unlock(&timers.lock)
}
// Add a timer to the heap and start or kick the timer proc.
@@ -120,14 +120,14 @@
// Discard result, because t might be moving in the heap.
_ = t.i
- golock(&timers.lock)
+ lock(&timers.lock)
// t may not be registered anymore and may have
// a bogus i (typically 0, if generated by Go).
// Verify it before proceeding.
i := t.i
last := len(timers.t) - 1
if i < 0 || i > last || timers.t[i] != t {
- gounlock(&timers.lock)
+ unlock(&timers.lock)
return false
}
if i != last {
@@ -140,7 +140,7 @@
siftupTimer(i)
siftdownTimer(i)
}
- gounlock(&timers.lock)
+ unlock(&timers.lock)
return true
}
@@ -151,7 +151,7 @@
timers.gp = getg()
timers.gp.issystem = true
for {
- golock(&timers.lock)
+ lock(&timers.lock)
timers.sleeping = false
now := nanotime()
delta := int64(-1)
@@ -185,12 +185,12 @@
}
f := t.f
arg := t.arg
- gounlock(&timers.lock)
+ unlock(&timers.lock)
if raceenabled {
raceacquire(unsafe.Pointer(t))
}
f(arg)
- golock(&timers.lock)
+ lock(&timers.lock)
}
if delta < 0 {
// No timers left - put goroutine to sleep.
@@ -201,7 +201,7 @@
// At least one timer pending. Sleep until then.
timers.sleeping = true
noteclear(&timers.waitnote)
- gounlock(&timers.lock)
+ unlock(&timers.lock)
notetsleepg(&timers.waitnote, delta)
}
}