Commit 41183d01 authored by S.Çağlar Onur's avatar S.Çağlar Onur Committed by Ian Lance Taylor

cgo/runtime: replace sigprocmask with pthread_sigmask.

sigprocmask use in a multithreaded environment is undefined so replace it with pthread_sigmask.

Fixes #6811.

R=jsing, iant
CC=golang-codereviews, golang-dev
https://golang.org/cl/30460043
parent da9e39db
......@@ -36,14 +36,14 @@ _cgo_sys_thread_start(ThreadStart *ts)
int err;
SIGFILLSET(ign);
sigprocmask(SIG_SETMASK, &ign, &oset);
pthread_sigmask(SIG_SETMASK, &ign, &oset);
pthread_attr_init(&attr);
pthread_attr_getstacksize(&attr, &size);
ts->g->stackguard = size;
err = pthread_create(&p, &attr, threadentry, ts);
sigprocmask(SIG_SETMASK, &oset, nil);
pthread_sigmask(SIG_SETMASK, &oset, nil);
if (err != 0) {
fprintf(stderr, "runtime/cgo: pthread_create failed: %s\n", strerror(err));
......
......@@ -35,7 +35,7 @@ _cgo_sys_thread_start(ThreadStart *ts)
int err;
SIGFILLSET(ign);
sigprocmask(SIG_SETMASK, &ign, &oset);
pthread_sigmask(SIG_SETMASK, &ign, &oset);
pthread_attr_init(&attr);
pthread_attr_getstacksize(&attr, &size);
......@@ -43,7 +43,7 @@ _cgo_sys_thread_start(ThreadStart *ts)
ts->g->stackguard = size;
err = pthread_create(&p, &attr, threadentry, ts);
sigprocmask(SIG_SETMASK, &oset, nil);
pthread_sigmask(SIG_SETMASK, &oset, nil);
if (err != 0) {
fprintf(stderr, "runtime/cgo: pthread_create failed: %s\n", strerror(err));
......
......@@ -36,14 +36,14 @@ _cgo_sys_thread_start(ThreadStart *ts)
int err;
SIGFILLSET(ign);
sigprocmask(SIG_SETMASK, &ign, &oset);
pthread_sigmask(SIG_SETMASK, &ign, &oset);
pthread_attr_init(&attr);
pthread_attr_getstacksize(&attr, &size);
ts->g->stackguard = size;
err = pthread_create(&p, &attr, threadentry, ts);
sigprocmask(SIG_SETMASK, &oset, nil);
pthread_sigmask(SIG_SETMASK, &oset, nil);
if (err != 0) {
fprintf(stderr, "runtime/cgo: pthread_create failed: %s\n", strerror(err));
......
......@@ -35,7 +35,7 @@ _cgo_sys_thread_start(ThreadStart *ts)
int err;
SIGFILLSET(ign);
sigprocmask(SIG_SETMASK, &ign, &oset);
pthread_sigmask(SIG_SETMASK, &ign, &oset);
pthread_attr_init(&attr);
pthread_attr_getstacksize(&attr, &size);
......@@ -43,7 +43,7 @@ _cgo_sys_thread_start(ThreadStart *ts)
ts->g->stackguard = size;
err = pthread_create(&p, &attr, threadentry, ts);
sigprocmask(SIG_SETMASK, &oset, nil);
pthread_sigmask(SIG_SETMASK, &oset, nil);
if (err != 0) {
fprintf(stderr, "runtime/cgo: pthread_create failed: %s\n", strerror(err));
......
......@@ -34,7 +34,7 @@ _cgo_sys_thread_start(ThreadStart *ts)
int err;
sigfillset(&ign);
sigprocmask(SIG_SETMASK, &ign, &oset);
pthread_sigmask(SIG_SETMASK, &ign, &oset);
// Not sure why the memset is necessary here,
// but without it, we get a bogus stack size
......@@ -46,7 +46,7 @@ _cgo_sys_thread_start(ThreadStart *ts)
ts->g->stackguard = size;
err = pthread_create(&p, &attr, threadentry, ts);
sigprocmask(SIG_SETMASK, &oset, nil);
pthread_sigmask(SIG_SETMASK, &oset, nil);
if (err != 0) {
fprintf(stderr, "runtime/cgo: pthread_create failed: %s\n", strerror(err));
......
......@@ -34,14 +34,14 @@ _cgo_sys_thread_start(ThreadStart *ts)
int err;
sigfillset(&ign);
sigprocmask(SIG_SETMASK, &ign, &oset);
pthread_sigmask(SIG_SETMASK, &ign, &oset);
pthread_attr_init(&attr);
pthread_attr_getstacksize(&attr, &size);
ts->g->stackguard = size;
err = pthread_create(&p, &attr, threadentry, ts);
sigprocmask(SIG_SETMASK, &oset, nil);
pthread_sigmask(SIG_SETMASK, &oset, nil);
if (err != 0) {
fprintf(stderr, "runtime/cgo: pthread_create failed: %s\n", strerror(err));
......
......@@ -35,14 +35,14 @@ _cgo_sys_thread_start(ThreadStart *ts)
int err;
sigfillset(&ign);
sigprocmask(SIG_SETMASK, &ign, &oset);
pthread_sigmask(SIG_SETMASK, &ign, &oset);
pthread_attr_init(&attr);
pthread_attr_getstacksize(&attr, &size);
ts->g->stackguard = size;
err = pthread_create(&p, &attr, threadentry, ts);
sigprocmask(SIG_SETMASK, &oset, nil);
pthread_sigmask(SIG_SETMASK, &oset, nil);
if (err != 0) {
fprintf(stderr, "runtime/cgo: pthread_create failed: %s\n", strerror(err));
......
......@@ -35,7 +35,7 @@ _cgo_sys_thread_start(ThreadStart *ts)
int err;
sigfillset(&ign);
sigprocmask(SIG_SETMASK, &ign, &oset);
pthread_sigmask(SIG_SETMASK, &ign, &oset);
pthread_attr_init(&attr);
pthread_attr_getstacksize(&attr, &size);
......@@ -43,7 +43,7 @@ _cgo_sys_thread_start(ThreadStart *ts)
ts->g->stackguard = size;
err = pthread_create(&p, &attr, threadentry, ts);
sigprocmask(SIG_SETMASK, &oset, nil);
pthread_sigmask(SIG_SETMASK, &oset, nil);
if (err != 0) {
fprintf(stderr, "runtime/cgo: pthread_create failed: %s\n", strerror(err));
......
......@@ -36,14 +36,14 @@ _cgo_sys_thread_start(ThreadStart *ts)
int err;
sigfillset(&ign);
sigprocmask(SIG_SETMASK, &ign, &oset);
pthread_sigmask(SIG_SETMASK, &ign, &oset);
pthread_attr_init(&attr);
pthread_attr_getstacksize(&attr, &size);
ts->g->stackguard = size;
err = pthread_create(&p, &attr, threadentry, ts);
sigprocmask(SIG_SETMASK, &oset, nil);
pthread_sigmask(SIG_SETMASK, &oset, nil);
if (err != 0) {
fprintf(stderr, "runtime/cgo: pthread_create failed: %s\n", strerror(err));
......
......@@ -122,14 +122,14 @@ _cgo_sys_thread_start(ThreadStart *ts)
int err;
sigfillset(&ign);
sigprocmask(SIG_SETMASK, &ign, &oset);
pthread_sigmask(SIG_SETMASK, &ign, &oset);
pthread_attr_init(&attr);
pthread_attr_getstacksize(&attr, &size);
ts->g->stackguard = size;
err = sys_pthread_create(&p, &attr, threadentry, ts);
sigprocmask(SIG_SETMASK, &oset, nil);
pthread_sigmask(SIG_SETMASK, &oset, nil);
if (err != 0) {
fprintf(stderr, "runtime/cgo: pthread_create failed: %s\n", strerror(err));
......
......@@ -122,7 +122,7 @@ _cgo_sys_thread_start(ThreadStart *ts)
int err;
sigfillset(&ign);
sigprocmask(SIG_SETMASK, &ign, &oset);
pthread_sigmask(SIG_SETMASK, &ign, &oset);
pthread_attr_init(&attr);
pthread_attr_getstacksize(&attr, &size);
......@@ -130,7 +130,7 @@ _cgo_sys_thread_start(ThreadStart *ts)
ts->g->stackguard = size;
err = sys_pthread_create(&p, &attr, threadentry, ts);
sigprocmask(SIG_SETMASK, &oset, nil);
pthread_sigmask(SIG_SETMASK, &oset, nil);
if (err != 0) {
fprintf(stderr, "runtime/cgo: pthread_create failed: %s\n", strerror(err));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment