]> Cypherpunks.ru repositories - gostls13.git/commitdiff
runtime: hide trace.shutdown behind traceShuttingDown
authorMichael Anthony Knyszek <mknyszek@google.com>
Tue, 9 May 2023 20:02:24 +0000 (20:02 +0000)
committerGopher Robot <gobot@golang.org>
Thu, 11 May 2023 21:27:10 +0000 (21:27 +0000)
Change-Id: I0b123e65f40570caeee611679d80dc27034d5a52
Reviewed-on: https://go-review.googlesource.com/c/go/+/494183
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>

src/runtime/proc.go
src/runtime/trace.go

index 3df0f84b3fcbe0518eb74787d84681df1b706139..2c8750a5fefbfcc042fdbbcc899917f02601e0ef 100644 (file)
@@ -2501,7 +2501,7 @@ func handoffp(pp *p) {
                return
        }
        // if there's trace work to do, start it straight away
-       if (traceEnabled() || trace.shutdown) && traceReaderAvailable() != nil {
+       if (traceEnabled() || traceShuttingDown()) && traceReaderAvailable() != nil {
                startm(pp, false, false)
                return
        }
@@ -2747,7 +2747,7 @@ top:
        now, pollUntil, _ := checkTimers(pp, 0)
 
        // Try to schedule the trace reader.
-       if traceEnabled() || trace.shutdown {
+       if traceEnabled() || traceShuttingDown() {
                gp := traceReader()
                if gp != nil {
                        casgstatus(gp, _Gwaiting, _Grunnable)
index 64314f62e875de5666a82db0c913987a9ad43f19..a89c407a8affe1abacb785dc392ee7fcfae3c36d 100644 (file)
@@ -211,6 +211,11 @@ func traceEnabled() bool {
        return trace.enabled
 }
 
+// traceShuttingDown returns true if the trace is currently shutting down.
+func traceShuttingDown() bool {
+       return trace.shutdown
+}
+
 // StartTrace enables tracing for the current process.
 // While tracing, the data will be buffered and available via ReadTrace.
 // StartTrace returns an error if tracing is already enabled.