public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* libgo patch committed: Lock goroutine to thread during cgo call
@ 2016-02-24 15:03 Ian Lance Taylor
  0 siblings, 0 replies; only message in thread
From: Ian Lance Taylor @ 2016-02-24 15:03 UTC (permalink / raw)
  To: gcc-patches, gofrontend-dev

[-- Attachment #1: Type: text/plain, Size: 280 bytes --]

This patch from Xia Bin fixes libgo to lock a goroutine to a thread
during a cgo call.  That is how the master library works, and it
avoids confusion if the C code calls back into the Go code.
Bootstrapped and ran Go testsuite on x86_64-pc-linux-gnu.  Committed
to mainline.

Ian

[-- Attachment #2: patch.txt --]
[-- Type: text/plain, Size: 1057 bytes --]

Index: gcc/go/gofrontend/MERGE
===================================================================
--- gcc/go/gofrontend/MERGE	(revision 233515)
+++ gcc/go/gofrontend/MERGE	(working copy)
@@ -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: libgo/runtime/go-cgo.c
===================================================================
--- libgo/runtime/go-cgo.c	(revision 232239)
+++ libgo/runtime/go-cgo.c	(working copy)
@@ -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.  */

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2016-02-24 15:03 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-24 15:03 libgo patch committed: Lock goroutine to thread during cgo call Ian Lance Taylor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).