From: ian Date: Wed, 24 Feb 2016 15:03:04 +0000 (+0000) Subject: runtime: lock M during cgo call X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=8aa3d53d57a81604661df063c05425ecce30c257;p=thirdparty%2Fgcc.git runtime: lock M during cgo call cgo should lock the M. See also https://golang.org/cl/18882 . Reviewed-on: https://go-review.googlesource.com/18883 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@233670 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE index 038e4346660a..9bebd30c431f 100644 --- a/gcc/go/gofrontend/MERGE +++ b/gcc/go/gofrontend/MERGE @@ -1,4 +1,4 @@ -1c3747d20789c73447ff71cbc739f7423c4bdf67 +156f5f0152797ac2afe5f23803aeb3c7b8f8418e The first line of this file holds the git revision number of the last merge done from the gofrontend repository. diff --git a/libgo/runtime/go-cgo.c b/libgo/runtime/go-cgo.c index a36eac92704e..610bcf5ec4e8 100644 --- a/libgo/runtime/go-cgo.c +++ b/libgo/runtime/go-cgo.c @@ -41,6 +41,8 @@ syscall_cgocall () if (runtime_needextram && runtime_cas (&runtime_needextram, 1, 0)) runtime_newextram (); + runtime_lockOSThread(); + m = runtime_m (); ++m->ncgocall; g = runtime_g (); @@ -70,6 +72,8 @@ syscall_cgocalldone () _cgo_panic will already have exited syscall mode. */ if (g->status == Gsyscall) runtime_exitsyscall (); + + runtime_unlockOSThread(); } /* Call back from C/C++ code to Go code. */