summaryrefslogtreecommitdiffhomepage
path: root/pkg/sleep/sleep_unsafe.go
diff options
context:
space:
mode:
authorBhasker Hariharan <bhaskerh@google.com>2019-05-22 18:56:18 -0700
committerShentubot <shentubot@google.com>2019-05-22 18:57:15 -0700
commit022bd0fd1091a29a41fa4c065ac35e45e3d6c576 (patch)
treeb5596c6d8f0f2d068845df03684ae352d224a0a6 /pkg/sleep/sleep_unsafe.go
parent79738d3958a027bcf449cf1bd608f3adec42b72c (diff)
Fix the signature for gopark.
gopark's signature was changed from having a string reason to a uint8. See: https://github.com/golang/go/commit/4d7cf3fedbc382215df5ff6167ee9782a9cc9375 This broke execution tracing of the sentry. Switching to the right signature makes tracing work again. Updates #220 PiperOrigin-RevId: 249565311 Change-Id: If77fd276cecb37d4003c8222f6de510b8031a074
Diffstat (limited to 'pkg/sleep/sleep_unsafe.go')
-rw-r--r--pkg/sleep/sleep_unsafe.go10
1 files changed, 8 insertions, 2 deletions
diff --git a/pkg/sleep/sleep_unsafe.go b/pkg/sleep/sleep_unsafe.go
index 62e0abc34..0526f52de 100644
--- a/pkg/sleep/sleep_unsafe.go
+++ b/pkg/sleep/sleep_unsafe.go
@@ -12,6 +12,9 @@
// See the License for the specific language governing permissions and
// limitations under the License.
+// +build go1.11
+// +build !go1.13
+
// Package sleep allows goroutines to efficiently sleep on multiple sources of
// notifications (wakers). It offers O(1) complexity, which is different from
// multi-channel selects which have O(n) complexity (where n is the number of
@@ -85,7 +88,7 @@ var (
)
//go:linkname gopark runtime.gopark
-func gopark(unlockf func(uintptr, *uintptr) bool, wg *uintptr, reason string, traceEv byte, traceskip int)
+func gopark(unlockf func(uintptr, *uintptr) bool, wg *uintptr, reason uint8, traceEv byte, traceskip int)
//go:linkname goready runtime.goready
func goready(g uintptr, traceskip int)
@@ -179,7 +182,10 @@ func (s *Sleeper) nextWaker(block bool) *Waker {
// commitSleep to decide whether to immediately
// wake the caller up or to leave it sleeping.
const traceEvGoBlockSelect = 24
- gopark(commitSleep, &s.waitingG, "sleeper", traceEvGoBlockSelect, 0)
+ // See:runtime2.go in the go runtime package for
+ // the values to pass as the waitReason here.
+ const waitReasonSelect = 9
+ gopark(commitSleep, &s.waitingG, waitReasonSelect, traceEvGoBlockSelect, 0)
}
// Pull the shared list out and reverse it in the local