diff options
author | Mattias Andrée <maandree@operamail.com> | 2015-05-17 14:49:22 +0200 |
---|---|---|
committer | Mattias Andrée <maandree@operamail.com> | 2015-05-17 14:49:22 +0200 |
commit | 5411b208af6b45cd45b00f45bc135b65a7ae899f (patch) | |
tree | be4d56e8b7a3efb63018d702f327a4b7c7662fad /doc/examples/timed/write.c | |
parent | m (diff) | |
download | bus-5411b208af6b45cd45b00f45bc135b65a7ae899f.tar.gz bus-5411b208af6b45cd45b00f45bc135b65a7ae899f.tar.bz2 bus-5411b208af6b45cd45b00f45bc135b65a7ae899f.tar.xz |
timed write example3.1
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to 'doc/examples/timed/write.c')
-rw-r--r-- | doc/examples/timed/write.c | 5 |
1 files changed, 4 insertions, 1 deletions
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; |