diff options
Diffstat (limited to 'lib/sqfs')
-rw-r--r-- | lib/sqfs/data_writer/internal.h | 1 | ||||
-rw-r--r-- | lib/sqfs/data_writer/pthread.c | 7 |
2 files changed, 8 insertions, 0 deletions
diff --git a/lib/sqfs/data_writer/internal.h b/lib/sqfs/data_writer/internal.h index d6e26cd..7af6ab4 100644 --- a/lib/sqfs/data_writer/internal.h +++ b/lib/sqfs/data_writer/internal.h @@ -24,6 +24,7 @@ #ifdef WITH_PTHREAD #include <pthread.h> +#include <signal.h> #endif diff --git a/lib/sqfs/data_writer/pthread.c b/lib/sqfs/data_writer/pthread.c index 3cdf8fb..915ea2a 100644 --- a/lib/sqfs/data_writer/pthread.c +++ b/lib/sqfs/data_writer/pthread.c @@ -45,6 +45,7 @@ sqfs_data_writer_t *sqfs_data_writer_create(size_t max_block_size, sqfs_file_t *file) { sqfs_data_writer_t *proc; + sigset_t set, oldset; unsigned int i; int ret; @@ -79,6 +80,9 @@ sqfs_data_writer_t *sqfs_data_writer_create(size_t max_block_size, goto fail_init; } + sigfillset(&set); + pthread_sigmask(SIG_SETMASK, &set, &oldset); + for (i = 0; i < num_workers; ++i) { ret = pthread_create(&proc->workers[i]->thread, NULL, worker_proc, proc->workers[i]); @@ -87,6 +91,8 @@ sqfs_data_writer_t *sqfs_data_writer_create(size_t max_block_size, goto fail_thread; } + pthread_sigmask(SIG_SETMASK, &oldset, NULL); + return proc; fail_thread: pthread_mutex_lock(&proc->mtx); @@ -99,6 +105,7 @@ fail_thread: pthread_join(proc->workers[i]->thread, NULL); } } + pthread_sigmask(SIG_SETMASK, &oldset, NULL); fail_init: for (i = 0; i < num_workers; ++i) { if (proc->workers[i] != NULL) { |