diff mbox

[v2,01/13] example: odp_generator: fix c99 usleep

Message ID 1424895578-24971-2-git-send-email-mike.holmes@linaro.org
State Superseded
Headers show

Commit Message

Mike Holmes Feb. 25, 2015, 8:19 p.m. UTC
Signed-off-by: Mike Holmes <mike.holmes@linaro.org>
---
 example/generator/odp_generator.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
diff mbox

Patch

diff --git a/example/generator/odp_generator.c b/example/generator/odp_generator.c
index 47cab6c..f3a315d 100644
--- a/example/generator/odp_generator.c
+++ b/example/generator/odp_generator.c
@@ -10,6 +10,7 @@ 
  * @example odp_generator.c ODP loopback demo application
  */
 
+#include <time.h>
 #include <stdlib.h>
 #include <string.h>
 #include <getopt.h>
@@ -397,7 +398,10 @@  static void *gen_send_thread(void *arg)
 			       odp_atomic_load_u64(&counters.seq),
 			       odp_atomic_load_u64(&counters.seq)%0xffff);
 			/* TODO use odp timer */
-			usleep(args->appl.interval * 1000);
+			struct timespec ts;
+			ts.tv_sec = 0;
+			ts.tv_nsec = args->appl.interval;
+			nanosleep(&ts, NULL);
 		}
 		if (args->appl.number != -1 &&
 		    odp_atomic_load_u64(&counters.seq)