mirror of
https://github.com/golang/go
synced 2024-11-12 06:20:22 -07:00
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
This commit is contained in:
parent
da9e39db86
commit
41183d015d
@ -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));
|
||||
|
Loading…
Reference in New Issue
Block a user