From: Mathieu Desnoyers Date: Wed, 24 Aug 2011 20:21:52 +0000 (-0400) Subject: Document prod/consumer synchro X-Git-Tag: v1.9.1~261 X-Git-Url: http://git.liburcu.org/?a=commitdiff_plain;h=49deb55988d873a8b8084ca75644b7d61c7a047c;p=lttng-ust.git Document prod/consumer synchro Signed-off-by: Mathieu Desnoyers --- diff --git a/libringbuffer/frontend_internal.h b/libringbuffer/frontend_internal.h index 02cb4d4a..1fb08dfd 100644 --- a/libringbuffer/frontend_internal.h +++ b/libringbuffer/frontend_internal.h @@ -386,6 +386,20 @@ void lib_ring_buffer_check_deliver(const struct lib_ring_buffer_config *config, * Wake-up the other end by * writing a null byte in the * pipe (non-blocking). + * Important note: Because + * writing into the pipe is + * non-blocking (and therefore + * we allow dropping wakeup + * data, as long as there is + * wakeup data present in the + * pipe buffer to wake up the + * consumer), the consumer + * should perform the following + * sequence for waiting: + * 1) empty the pipe (reads). + * 2) check if there is data in + * the buffer. + * 3) wait on the pipe (poll). */ do { ret = write(wakeup_fd, "", 1);