X-Git-Url: http://git.lttng.org/?p=lttng-ust.git;a=blobdiff_plain;f=libringbuffer%2Ffrontend_internal.h;fp=libringbuffer%2Ffrontend_internal.h;h=9ff28e3968e503d7d8e974064f1b3150f236088c;hp=2d3b1071f9e4f10565ca52b0385c65359a8866f2;hb=8a9f3798dd0442b480d3b3371bc0278f897c12c8;hpb=858276a2e832704ad5c461e5db22cfd6c978b87a diff --git a/libringbuffer/frontend_internal.h b/libringbuffer/frontend_internal.h index 2d3b1071..9ff28e39 100644 --- a/libringbuffer/frontend_internal.h +++ b/libringbuffer/frontend_internal.h @@ -457,11 +457,20 @@ void lib_ring_buffer_check_deliver(const struct lttng_ust_lib_ring_buffer_config ret = write(wakeup_fd, "", 1); } while (ret == -1L && errno == EINTR); if (ret == -1L && errno == EPIPE && !sigpipe_was_pending) { - struct timespec timeout = { 0, 0 }; - do { - ret = sigtimedwait(&sigpipe_set, NULL, - &timeout); - } while (ret == -1L && errno == EINTR); + ret = sigpending(&pending_set); + assert(!ret); + + if (sigismember(&pending_set, SIGPIPE)) { + /* + * Kill ourselves with SIGPIPE and wait on + * delivery, thus effectively discarding it. + */ + pthread_t self = pthread_self(); + pthread_kill(self, SIGPIPE); + do { + ret = sigwaitinfo(&sigpipe_set, NULL); + } while (ret == -1L && errno == EINTR); + } } if (!sigpipe_was_pending) { ret = pthread_sigmask(SIG_SETMASK, &old_set, NULL);