summaryrefslogtreecommitdiff
path: root/src/pkg/runtime/cgo/gcc_freebsd_arm.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/pkg/runtime/cgo/gcc_freebsd_arm.c')
-rw-r--r--src/pkg/runtime/cgo/gcc_freebsd_arm.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/pkg/runtime/cgo/gcc_freebsd_arm.c b/src/pkg/runtime/cgo/gcc_freebsd_arm.c
index 211dca75c..6175e1d9c 100644
--- a/src/pkg/runtime/cgo/gcc_freebsd_arm.c
+++ b/src/pkg/runtime/cgo/gcc_freebsd_arm.c
@@ -4,7 +4,9 @@
#include <sys/types.h>
#include <machine/sysarch.h>
+#include <sys/signalvar.h>
#include <pthread.h>
+#include <signal.h>
#include <string.h>
#include "libcgo.h"
@@ -39,10 +41,14 @@ void
_cgo_sys_thread_start(ThreadStart *ts)
{
pthread_attr_t attr;
+ sigset_t ign, oset;
pthread_t p;
size_t size;
int err;
+ SIGFILLSET(ign);
+ pthread_sigmask(SIG_SETMASK, &ign, &oset);
+
// Not sure why the memset is necessary here,
// but without it, we get a bogus stack size
// out of pthread_attr_getstacksize. C'est la Linux.
@@ -52,6 +58,9 @@ _cgo_sys_thread_start(ThreadStart *ts)
pthread_attr_getstacksize(&attr, &size);
ts->g->stackguard = size;
err = pthread_create(&p, &attr, threadentry, ts);
+
+ pthread_sigmask(SIG_SETMASK, &oset, nil);
+
if (err != 0) {
fprintf(stderr, "runtime/cgo: pthread_create failed: %s\n", strerror(err));
abort();