aboutsummaryrefslogtreecommitdiffstats
path: root/src/bus.h
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2015-05-15 15:04:25 +0200
committerMattias Andrée <maandree@operamail.com>2015-05-15 15:04:25 +0200
commit40341a0eec50588f574199a3ee213dbb97b576e5 (patch)
treedcf36c75385bb593086c10c7cf0a502d6f5311c8 /src/bus.h
parentupdate examples (diff)
downloadbus-40341a0eec50588f574199a3ee213dbb97b576e5.tar.gz
bus-40341a0eec50588f574199a3ee213dbb97b576e5.tar.bz2
bus-40341a0eec50588f574199a3ee213dbb97b576e5.tar.xz
fix nowait for polling + add nonblocking example
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to 'src/bus.h')
-rw-r--r--src/bus.h23
1 files changed, 15 insertions, 8 deletions
diff --git a/src/bus.h b/src/bus.h
index 4f38067..2cd534b 100644
--- a/src/bus.h
+++ b/src/bus.h
@@ -105,6 +105,12 @@ typedef struct bus
* if `bus_poll` failed during reading
*/
int first_poll;
+
+ /**
+ * Flags used for polling
+ */
+ int flags;
+
} bus_t;
@@ -199,10 +205,13 @@ int bus_read(const bus_t *bus, int (*callback)(const char *message, void *user_d
* misbehave, is `bus_poll` is written to expect
* this function to have been called.
*
- * @param bus Bus information
- * @return 0 on success, -1 on error
+ * @param bus Bus information
+ * @param flags `IPC_NOWAIT` if the bus should fail and set `errno` to
+ * `EAGAIN` if there isn't already a message available on
+ * the bus when `bus_poll` is called
+ * @return 0 on success, -1 on error
*/
-int bus_poll_start(bus_t *bus);
+int bus_poll_start(bus_t *bus, int flags);
/**
* Announce that the thread has stopped listening on the bus.
@@ -222,12 +231,10 @@ int bus_poll_stop(const bus_t *bus);
* 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
+ * @param bus Bus information
+ * @return The received message, `NULL` on error
*/
-const char *bus_poll(bus_t *bus, int flags);
+const char *bus_poll(bus_t *bus);
/* TODO bus_poll_timed */