]> Cypherpunks.ru repositories - gostls13.git/commit
runtime: free Windows event handles after last lock is dropped
authorJason A. Donenfeld <Jason@zx2c4.com>
Fri, 15 Jan 2021 12:01:37 +0000 (13:01 +0100)
committerJason A. Donenfeld <Jason@zx2c4.com>
Mon, 18 Jan 2021 18:16:12 +0000 (18:16 +0000)
commitdbab07983596c705d2ef12806e0f9d630063e571
treeeeaaf7725034ade0ca0978928b39a20c7a192439
parent5a8fbb0d2d339fa87a02c0794f5a92c1ce121631
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>
12 files changed:
src/runtime/os3_solaris.go
src/runtime/os_aix.go
src/runtime/os_darwin.go
src/runtime/os_dragonfly.go
src/runtime/os_freebsd.go
src/runtime/os_js.go
src/runtime/os_linux.go
src/runtime/os_netbsd.go
src/runtime/os_openbsd.go
src/runtime/os_plan9.go
src/runtime/os_windows.go
src/runtime/proc.go