From 40d81cf061d8a2a277d70446f582a984c1701ff3 Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Tue, 18 Oct 2016 10:26:07 -0400 Subject: sync: throw, not panic, for unlock of unlocked mutex The panic leaves the lock in an unusable state. Trying to panic with a usable state makes the lock significantly less efficient and scalable (see early CL patch sets and discussion). Instead, use runtime.throw, which will crash the program directly. In general throw is reserved for when the runtime detects truly serious, unrecoverable problems. This problem is certainly serious, and, without a significant performance hit, is unrecoverable. Fixes #13879. Change-Id: I41920d9e2317270c6f909957d195bd8b68177f8d Reviewed-on: https://go-review.googlesource.com/31359 Reviewed-by: Austin Clements Reviewed-by: Brad Fitzpatrick --- src/runtime/panic.go | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/runtime') diff --git a/src/runtime/panic.go b/src/runtime/panic.go index 9e108cc437..f78e67f9bb 100644 --- a/src/runtime/panic.go +++ b/src/runtime/panic.go @@ -576,6 +576,11 @@ func dopanic(unused int) { *(*int)(nil) = 0 } +//go:linkname sync_throw sync.throw +func sync_throw(s string) { + throw(s) +} + //go:nosplit func throw(s string) { print("fatal error: ", s, "\n") -- cgit v1.3-5-g9baa