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: Use pthread_sigmask, not sigprocmask


A threaded program is supposed to call pthread_sigmask rather than
sigprocmask.  The functions do the same thing, and there is no
difference on GNU/Linux, but pthread_sigmask is preferred.  This patch
to libgo changes it to do that.  Bootstrapped and ran Go testsuite on
x86_64-unknown-linux-gnu.  Committed to mainline.

Ian

diff -r 6240f021157f libgo/runtime/go-signal.c
--- a/libgo/runtime/go-signal.c	Tue Dec 03 06:41:22 2013 -0800
+++ b/libgo/runtime/go-signal.c	Tue Dec 03 17:33:24 2013 -0800
@@ -252,7 +252,7 @@
   /* The signal handler blocked signals; unblock them.  */
   i = sigfillset (&clear);
   __go_assert (i == 0);
-  i = sigprocmask (SIG_UNBLOCK, &clear, NULL);
+  i = pthread_sigmask (SIG_UNBLOCK, &clear, NULL);
   __go_assert (i == 0);
 }
 
diff -r 6240f021157f libgo/runtime/proc.c
--- a/libgo/runtime/proc.c	Tue Dec 03 06:41:22 2013 -0800
+++ b/libgo/runtime/proc.c	Tue Dec 03 17:33:24 2013 -0800
@@ -208,9 +208,9 @@
 #endif
 
 	sigemptyset(&old);
-	sigprocmask(SIG_BLOCK, &clear, &old);
+	pthread_sigmask(SIG_BLOCK, &clear, &old);
 	ret = pthread_create(&tid, &attr, runtime_mstart, mp);
-	sigprocmask(SIG_SETMASK, &old, nil);
+	pthread_sigmask(SIG_SETMASK, &old, nil);
 
 	if (ret != 0)
 		runtime_throw("pthread_create");
diff -r 6240f021157f libgo/runtime/runtime.c
--- a/libgo/runtime/runtime.c	Tue Dec 03 06:41:22 2013 -0800
+++ b/libgo/runtime/runtime.c	Tue Dec 03 17:33:24 2013 -0800
@@ -256,7 +256,7 @@
 	runtime_signalstack(m->gsignalstack, m->gsignalstacksize);
 	if (sigemptyset(&sigs) != 0)
 		runtime_throw("sigemptyset");
-	sigprocmask(SIG_SETMASK, &sigs, nil);
+	pthread_sigmask(SIG_SETMASK, &sigs, nil);
 }
 
 // Called from dropm to undo the effect of an minit.

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