]> Cypherpunks repositories - gostls13.git/commit
runtime: avoid CreateThread panic when exiting process
authorAustin Clements <austin@google.com>
Tue, 20 Dec 2016 20:37:56 +0000 (15:37 -0500)
committerAustin Clements <austin@google.com>
Wed, 21 Dec 2016 16:39:01 +0000 (16:39 +0000)
commitf24384f686745f95086e7f400e884a218f4456d3
treeb031b8d0de5e25f2828763f76c945a00ff26dca0
parentc44da14440e5a2e412f9b1d3f5f2f562591d8e49
runtime: avoid CreateThread panic when exiting process

On Windows, CreateThread occasionally fails with ERROR_ACCESS_DENIED.
We're not sure why this is, but the Wine source code suggests that
this can happen when there's a concurrent CreateThread and ExitProcess
in the same process.

Fix this by setting a flag right before calling ExitProcess and
halting if CreateThread fails and this flag is set.

Updates #18253 (might fix it, but we're not sure this is the issue and
can't reproduce it on demand).

Change-Id: I1945b989e73a16cf28a35bf2613ffab07577ed4e
Reviewed-on: https://go-review.googlesource.com/34616
TryBot-Result: Gobot Gobot <gobot@golang.org>
Run-TryBot: Austin Clements <austin@google.com>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
src/runtime/os_windows.go