diff mbox

[v5,1/8] example: odp_generator: fix c99 usleep

Message ID 1425048757-28438-1-git-send-email-mike.holmes@linaro.org
State Accepted
Commit 433a1cc1c53b06e5809aac5f0a613917fd044207
Headers show

Commit Message

Mike Holmes Feb. 27, 2015, 2:52 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(-)

Comments

Maxim Uvarov Feb. 27, 2015, 3:26 p.m. UTC | #1
Reviewed-and-tested-by: Maxim Uvarov <maxim.uvarov@linaro.org>

Patch 8 will be patch 7 and patch 7 will be patch 8.

Maxim.

On 02/27/2015 05:52 PM, Mike Holmes wrote:
> Signed-off-by: Mike Holmes <mike.holmes@linaro.org>
> ---
>   example/generator/odp_generator.c | 6 +++++-
>   1 file changed, 5 insertions(+), 1 deletion(-)
>
> 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)
Maxim Uvarov Feb. 27, 2015, 3:35 p.m. UTC | #2
Merged,
Maxim.

On 02/27/2015 05:52 PM, Mike Holmes wrote:
> Signed-off-by: Mike Holmes <mike.holmes@linaro.org>
> ---
>   example/generator/odp_generator.c | 6 +++++-
>   1 file changed, 5 insertions(+), 1 deletion(-)
>
> 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)
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)