This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
libgo patch committed: Use pthread_sigmask, not sigprocmask
- From: Ian Lance Taylor <iant at google dot com>
- To: gcc-patches at gcc dot gnu dot org, gofrontend-dev at googlegroups dot com
- Date: Tue, 03 Dec 2013 17:35:59 -0800
- Subject: libgo patch committed: Use pthread_sigmask, not sigprocmask
- Authentication-results: sourceware.org; auth=none
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.