diff --git a/include/tarantool_pthread.h b/include/tarantool_pthread.h index 41094a031a8fe493fed88bdab1144d1583e30d95..70d847c2b14fc2de34567b8d4b91570b64562e71 100644 --- a/include/tarantool_pthread.h +++ b/include/tarantool_pthread.h @@ -154,5 +154,17 @@ tt_pthread_error(e); \ }) +/** Make sure the created thread blocks all signals, + * they are handled in the main thread. + */ +#define tt_pthread_create(thread, attr, run, arg) \ +({ sigset_t set, oldset; \ + sigfillset(&set); \ + pthread_sigmask(SIG_BLOCK, &set, &oldset); \ + int e = pthread_create(thread, attr, run, arg); \ + pthread_sigmask(SIG_SETMASK, &oldset, NULL); \ + tt_pthread_error(e); \ +}) + #endif /* TARANTOOL_PTHREAD_H_INCLUDED */ diff --git a/src/log_io.m b/src/log_io.m index 684842164a11c8345f4cc7643a7aaf62c3a4dbce..cb6310644755cad0898c0c4a6c77eef24ea577f6 100644 --- a/src/log_io.m +++ b/src/log_io.m @@ -1357,8 +1357,8 @@ wal_writer_start(struct recovery_state *state) /* II. Start the thread. */ - if (pthread_create(&wal_writer.thread, NULL, wal_writer_thread, - state)) { + if (tt_pthread_create(&wal_writer.thread, NULL, wal_writer_thread, + state)) { wal_writer_destroy(&wal_writer); state->writer = NULL; return -1;