From dc61596aabe1d74718ba999f1002e0d7d88a944e Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Mon, 27 Apr 2015 01:17:21 +0200 Subject: add nowait option to bus_write MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/bus.h | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'src/bus.h') diff --git a/src/bus.h b/src/bus.h index 52d0e98..ed1c5de 100644 --- a/src/bus.h +++ b/src/bus.h @@ -57,6 +57,12 @@ */ #define BUS_INTR 4 +/** + * Function shall fail with errno set to `EAGAIN` + * if the it would block and this flag is used + */ +#define BUS_NOWAIT 1 + /** @@ -150,9 +156,12 @@ int bus_close(bus_t *bus); * @param bus Bus information * @param message The message to write, may not be longer than * `BUS_MEMORY_SIZE` including the NUL-termination + * @param flags `BUS_NOWAIT` if this function shall fail if + * another process is currently running this + * procedure * @return 0 on success, -1 on error */ -int bus_write(const bus_t *bus, const char *message); +int bus_write(const bus_t *bus, const char *message, int flags); /** * Listen (in a loop, forever) for new message on a bus @@ -181,7 +190,7 @@ int bus_read(const bus_t *bus, int (*callback)(const char *message, void *user_d int bus_poll_start(bus_t *bus); int bus_poll_stop(const bus_t *bus); -const char *bus_poll(bus_t *bus); +const char *bus_poll(bus_t *bus, int falgs); -- cgit v1.2.3-70-g09d2