1
0
mirror of https://github.com/golang/go synced 2024-11-12 07:10:22 -07:00
go/misc
David Crawshaw 3b22ffc07e runtime: make cgocallback wait on package init
With the new buildmodes c-archive and c-shared, it is possible for a
cgo call to come in early in the lifecycle of a Go program. Calls
before the runtime has been initialized are caught by
_cgo_wait_runtime_init_done. However a call can come in after the
runtime has initialized, but before the program's package init
functions have finished running.

To avoid this cgocallback checks m.ncgo to see if we are on a thread
running Go. If not, we may be a foreign thread and it blocks until
main_init is complete.

Change-Id: I7a9f137fa2a40c322a0b93764261f9aa17fcf5b8
Reviewed-on: https://go-review.googlesource.com/8897
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: David Crawshaw <crawshaw@golang.org>
2015-04-14 13:39:02 +00:00
..
android misc/android: choose the right subdirectory for bin under GOPATH. 2015-01-16 22:02:52 +00:00
arm arm: add gdb support to android launcher script 2010-07-30 10:35:07 +03:00
cgo runtime: make cgocallback wait on package init 2015-04-14 13:39:02 +00:00
chrome/gophertool misc/chrome/gophertool: update for the git/gerrit transition 2014-12-18 07:34:46 +00:00
git misc/git: add gofmt git pre-commit hook 2012-11-15 19:58:49 +01:00
ios misc/ios: support go run in go_darwin_arm_exec 2015-04-13 18:59:52 +00:00
linkcheck misc/linkcheck: better redirect handling, use meaningful exit code 2013-10-25 17:31:02 +03:00
makerelease misc/makerelease: send file size when uploading 2015-01-20 04:09:23 +00:00
nacl cmd/api: re-enable TestGolden on nacl 2015-04-08 06:36:36 +00:00
swig misc/swig/callback: fix test for SWIG -cgo support 2015-03-06 15:28:50 +00:00
trace cmd/trace: add new command 2015-02-20 18:31:25 +00:00
benchcmp all: use golang.org/x/... import paths 2014-11-10 09:15:57 +11:00
editors all: don't refer to code.google.com/p/go{,-wiki}/ 2015-02-06 14:41:47 +00:00