From cd02c2a0f43553da30ecf49e5d5a5d3361a22761 Mon Sep 17 00:00:00 2001 From: Juan Jose Garcia Ripoll Date: Sun, 8 Apr 2012 00:24:36 +0200 Subject: [PATCH] Totally block signals until a thread is completely set up. --- src/c/threads/process.d | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/c/threads/process.d b/src/c/threads/process.d index 3e26b74ba..38942f55c 100644 --- a/src/c/threads/process.d +++ b/src/c/threads/process.d @@ -243,10 +243,8 @@ thread_entry_point(void *arg) CL_CATCH_ALL_BEGIN(env) { #ifdef HAVE_SIGPROCMASK { - sigset_t new; - sigemptyset(&new); - sigaddset(&new, ecl_option_values[ECL_OPT_THREAD_INTERRUPT_SIGNAL]); - pthread_sigmask(SIG_UNBLOCK, &new, NULL); + sigset_t *new = (sigset_t*)env->default_sigmask; + pthread_sigmask(SIG_SETMASK, new, NULL); } #endif process->process.phase = ECL_PROCESS_ACTIVE; @@ -497,9 +495,9 @@ mp_process_enable(cl_object process) */ #ifdef HAVE_SIGPROCMASK { - sigset_t previous, new = *((sigset_t*)process_env->default_sigmask); - sigaddset(&new, ecl_option_values[ECL_OPT_THREAD_INTERRUPT_SIGNAL]); - pthread_sigmask(SIG_SETMASK, &new, &previous); + sigset_t new, previous; + sigfillset(&new); + pthread_sigmask(SIG_BLOCK, &new, &previous); code = pthread_create(&process->process.thread, &pthreadattr, thread_entry_point, process); pthread_sigmask(SIG_SETMASK, &previous, NULL);