X-Git-Url: https://git.kernel.dk/?a=blobdiff_plain;f=helper_thread.c;h=7874985504be2aa6c4c82c7683320c39409d927d;hb=6463db6c1d3a2a961008e87a86d464b596886f1a;hp=28f6cca323d303fc370877610ba65513d509cd39;hpb=52a552e21ae25eb175f686935fe85a2956f949ce;p=fio.git diff --git a/helper_thread.c b/helper_thread.c index 28f6cca3..78749855 100644 --- a/helper_thread.c +++ b/helper_thread.c @@ -1,3 +1,4 @@ +#include #ifdef CONFIG_VALGRIND_DEV #include #else @@ -137,6 +138,18 @@ static void *helper_thread_main(void *data) sk_out_assign(hd->sk_out); +#ifdef HAVE_PTHREAD_SIGMASK + { + sigset_t sigmask; + + /* Let another thread handle signals. */ + ret = pthread_sigmask(SIG_UNBLOCK, NULL, &sigmask); + assert(ret == 0); + ret = pthread_sigmask(SIG_BLOCK, &sigmask, NULL); + assert(ret == 0); + } +#endif + #ifdef CONFIG_PTHREAD_CONDATTR_SETCLOCK clock_gettime(CLOCK_MONOTONIC, &ts); #else @@ -163,7 +176,10 @@ static void *helper_thread_main(void *data) FD_SET(hd->pipe[0], &rfds); FD_ZERO(&efds); FD_SET(hd->pipe[0], &efds); - select(1, &rfds, NULL, &efds, &timeout); + ret = select(1, &rfds, NULL, &efds, &timeout); + if (ret < 0) + log_err("fio: select() call in helper thread failed: %s", + strerror(errno)); if (read_from_pipe(hd->pipe[0], &action, sizeof(action)) < 0) action = 0;