aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/trace.go
diff options
context:
space:
mode:
authorAustin Clements <austin@google.com>2015-01-30 15:30:41 -0500
committerAustin Clements <austin@google.com>2015-02-02 19:34:51 +0000
commit28b51184156e1261bb92e7ec4050a794dd606fa6 (patch)
tree8d8659e3e706f687b241e8068ef80ff80987c3d2 /src/runtime/trace.go
parentf95becaddb539a45cc9bedbbbc9ee4a2433c1ab5 (diff)
downloadgo-28b51184156e1261bb92e7ec4050a794dd606fa6.tar.xz
runtime: rename m.gcing to m.preemptoff and make it a string
m.gcing has become overloaded to mean "don't preempt this g" in general. Once the garbage collector is preemptible, the one thing it *won't* mean is that we're in the garbage collector. So, rename gcing to "preemptoff" and make it a string giving a reason that preemption is disabled. gcing was never set to anything but 0 or 1, so we don't have to worry about there being a stack of reasons. Change-Id: I4337c29e8e942e7aa4f106fc29597e1b5de4ef46 Reviewed-on: https://go-review.googlesource.com/3660 Reviewed-by: Russ Cox <rsc@golang.org>
Diffstat (limited to 'src/runtime/trace.go')
-rw-r--r--src/runtime/trace.go12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/runtime/trace.go b/src/runtime/trace.go
index 7da588b5e6..5b168c7bfc 100644
--- a/src/runtime/trace.go
+++ b/src/runtime/trace.go
@@ -121,7 +121,7 @@ func StartTrace() error {
// of all goroutines at the beginning of the trace.
semacquire(&worldsema, false)
_g_ := getg()
- _g_.m.gcing = 1
+ _g_.m.preemptoff = "start tracing"
systemstack(stoptheworld)
// We are in stop-the-world, but syscalls can finish and write to trace concurrently.
@@ -133,7 +133,7 @@ func StartTrace() error {
if trace.enabled || trace.shutdown {
unlock(&trace.bufLock)
- _g_.m.gcing = 0
+ _g_.m.preemptoff = ""
semrelease(&worldsema)
systemstack(starttheworld)
return errorString("tracing is already enabled")
@@ -162,7 +162,7 @@ func StartTrace() error {
unlock(&trace.bufLock)
- _g_.m.gcing = 0
+ _g_.m.preemptoff = ""
semrelease(&worldsema)
systemstack(starttheworld)
return nil
@@ -175,7 +175,7 @@ func StopTrace() {
// and also to avoid races with traceEvent.
semacquire(&worldsema, false)
_g_ := getg()
- _g_.m.gcing = 1
+ _g_.m.preemptoff = "stop tracing"
systemstack(stoptheworld)
// See the comment in StartTrace.
@@ -183,7 +183,7 @@ func StopTrace() {
if !trace.enabled {
unlock(&trace.bufLock)
- _g_.m.gcing = 0
+ _g_.m.preemptoff = ""
semrelease(&worldsema)
systemstack(starttheworld)
return
@@ -224,7 +224,7 @@ func StopTrace() {
unlock(&trace.bufLock)
- _g_.m.gcing = 0
+ _g_.m.preemptoff = ""
semrelease(&worldsema)
systemstack(starttheworld)