From 5411b208af6b45cd45b00f45bc135b65a7ae899f Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Sun, 17 May 2015 14:49:22 +0200 Subject: timed write example MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- doc/examples/timed/write.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'doc/examples/timed/write.c') diff --git a/doc/examples/timed/write.c b/doc/examples/timed/write.c index 250ba14..acd8c6f 100644 --- a/doc/examples/timed/write.c +++ b/doc/examples/timed/write.c @@ -15,13 +15,16 @@ int main(int argc, char *argv[]) { bus_t bus; + struct timespec timeout; if (argc < 2) { fprintf(stderr, "%s: USAGE: %s message\n", argv[0], argv[0]); return 2; } sprintf(message, "0 %s", argv[1]); t(bus_open(&bus, "/tmp/example-bus", BUS_WRONLY)); - t(bus_write(&bus, message, 0)); + t(clock_gettime(CLOCK_MONOTONIC, &timeout)); + timeout.tv_nsec += 100000000L; + t(bus_write_timed(&bus, message, &timeout, CLOCK_MONOTONIC)); bus_close(&bus); return 0; -- cgit v1.2.3-70-g09d2