]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
runtime: lock M during cgo call
authorIan Lance Taylor <ian@gcc.gnu.org>
Wed, 24 Feb 2016 15:03:04 +0000 (15:03 +0000)
committerIan Lance Taylor <ian@gcc.gnu.org>
Wed, 24 Feb 2016 15:03:04 +0000 (15:03 +0000)
    cgo should lock the M.

    See also https://golang.org/cl/18882 .

    Reviewed-on: https://go-review.googlesource.com/18883

From-SVN: r233670

gcc/go/gofrontend/MERGE
libgo/runtime/go-cgo.c

index 038e4346660a0bbc37c912159454f95defb790ae..9bebd30c431f830d9bd889700ae971ce60571972 100644 (file)
@@ -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.
index a36eac92704eb55e1680495559f0806ec1805bf1..610bcf5ec4e8d246f34fb3162a6dc5ae26df9cf4 100644 (file)
@@ -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.  */