aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/os_linux.go
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2021-01-15 13:01:37 +0100
committerJason A. Donenfeld <Jason@zx2c4.com>2021-01-18 18:16:12 +0000
commitdbab07983596c705d2ef12806e0f9d630063e571 (patch)
treeeeaaf7725034ade0ca0978928b39a20c7a192439 /src/runtime/os_linux.go
parent5a8fbb0d2d339fa87a02c0794f5a92c1ce121631 (diff)
downloadgo-dbab07983596c705d2ef12806e0f9d630063e571.tar.xz
runtime: free Windows event handles after last lock is dropped
Calls to lock may need to use global members of mOS that also need to be cleaned up before the thread exits. Before this commit, these resources would leak. Moving them to be cleaned up in unminit, however, would race with gstack on unix. So this creates a new helper, mdestroy, to release resources that must be destroyed only after locks are no longer required. We also move highResTimer lifetime to the same semantics, since it doesn't help to constantly acquire and release the timer object during dropm. Updates #43720. Change-Id: Ib3f598f3fda1b2bbcb608099616fa4f85bc1c289 Reviewed-on: https://go-review.googlesource.com/c/go/+/284137 Run-TryBot: Jason A. Donenfeld <Jason@zx2c4.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-by: Austin Clements <austin@google.com> Trust: Alex Brainman <alex.brainman@gmail.com> Trust: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'src/runtime/os_linux.go')
-rw-r--r--src/runtime/os_linux.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/runtime/os_linux.go b/src/runtime/os_linux.go
index f122d2c2ef..058c7daf9c 100644
--- a/src/runtime/os_linux.go
+++ b/src/runtime/os_linux.go
@@ -375,6 +375,11 @@ func unminit() {
unminitSignals()
}
+// Called from exitm, but not from drop, to undo the effect of thread-owned
+// resources in minit, semacreate, or elsewhere. Do not take locks after calling this.
+func mdestroy(mp *m) {
+}
+
//#ifdef GOARCH_386
//#define sa_handler k_sa_handler
//#endif