From 17c4ef2204e09acf7e383ae57df3049f36f2068a Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Fri, 1 May 2015 13:18:15 +0200 Subject: doc bus_poll MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/bus.c | 13 +++++++++++++ src/bus.h | 14 ++++++++++++++ 2 files changed, 27 insertions(+) (limited to 'src') diff --git a/src/bus.c b/src/bus.c index 369fa2f..19270fb 100644 --- a/src/bus.c +++ b/src/bus.c @@ -766,6 +766,19 @@ bus_poll_stop(const bus_t *bus) } +/** + * Wait for a message to be broadcasted on the bus. + * The caller should make a copy of the received message, + * without freeing the original copy, and parse it in a + * separate thread. When the new thread has started be + * started, the caller of this function should then + * either call `bus_poll` again or `bus_poll_stop`. + * + * @param bus Bus information + * @param flags `IPC_NOWAIT` if the bus should fail and set `errno` to + * `EAGAIN` if this isn't already a message available on the bus + * @return The received message, `NULL` on error + */ const char * bus_poll(bus_t *bus, int flags) { diff --git a/src/bus.h b/src/bus.h index d8112f2..3ab83de 100644 --- a/src/bus.h +++ b/src/bus.h @@ -211,6 +211,20 @@ int bus_poll_start(bus_t *bus); * @return 0 on success, -1 on error */ int bus_poll_stop(const bus_t *bus); + +/** + * Wait for a message to be broadcasted on the bus. + * The caller should make a copy of the received message, + * without freeing the original copy, and parse it in a + * separate thread. When the new thread has started be + * started, the caller of this function should then + * either call `bus_poll` again or `bus_poll_stop`. + * + * @param bus Bus information + * @param flags `IPC_NOWAIT` if the bus should fail and set `errno` to + * `EAGAIN` if this isn't already a message available on the bus + * @return The received message, `NULL` on error + */ const char *bus_poll(bus_t *bus, int flags); -- cgit v1.2.3-70-g09d2