This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

libgo patch committed: Ignore SIGPROF on non-Go thread


This patch to libgo ignores a SIGPROF signal if it is received on a
non-Go thread.  This permits the Go library profiling support to work in
a program that calls C/C++ code that starts threads.  Bootstrapped and
ran Go testsuite on x86_64-unknown-linux-gnu.  Committed to mainline and
4.8 branch.

Ian

diff -r f1650653ba7d libgo/runtime/go-signal.c
--- a/libgo/runtime/go-signal.c	Tue Jul 16 15:42:30 2013 -0700
+++ b/libgo/runtime/go-signal.c	Mon Jul 22 21:39:43 2013 -0700
@@ -166,21 +166,22 @@
   int i;
 
   m = runtime_m ();
+
+#ifdef SIGPROF
+  if (sig == SIGPROF)
+    {
+      if (m != NULL && gp != m->g0 && gp != m->gsignal)
+	runtime_sigprof ();
+      return;
+    }
+#endif
+
   if (m == NULL)
     {
       runtime_badsignal (sig);
       return;
     }
 
-#ifdef SIGPROF
-  if (sig == SIGPROF)
-    {
-      if (gp != runtime_m ()->g0 && gp != runtime_m ()->gsignal)
-	runtime_sigprof ();
-      return;
-    }
-#endif
-
   for (i = 0; runtime_sigtab[i].sig != -1; ++i)
     {
       SigTab *t;

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]