Bhanuprakash Bodireddy <bhanuprakash.bodire...@intel.com> writes:

> This will be used by KA framework that needs millisecond granularity.
>
> Signed-off-by: Bhanuprakash Bodireddy <bhanuprakash.bodire...@intel.com>
> ---

Without this patch, builds starting at 3/7 will fail.  That's pretty
bad.  Please see my earlier comment about including helpers when they
are used.

>  lib/util.c | 12 ++++++++++++
>  lib/util.h |  1 +
>  2 files changed, 13 insertions(+)
>
> diff --git a/lib/util.c b/lib/util.c
> index 1c06ce0..889ebd8 100644
> --- a/lib/util.c
> +++ b/lib/util.c
> @@ -2125,6 +2125,18 @@ xsleep(unsigned int seconds)
>      ovsrcu_quiesce_end();
>  }
>  
> +void
> +xusleep(unsigned int microseconds)
> +{
> +    ovsrcu_quiesce_start();
> +#ifdef _WIN32
> +    Sleep(microseconds/1000);
> +#else
> +    usleep(microseconds);
> +#endif
> +    ovsrcu_quiesce_end();
> +}
> +

Wow!  This is deceptive.  If I call this with microseconds argument as,
say, 999 there's a *strong* chance this will NOT sleep for at least that
amount of time.  This function needs a different implementation or just
keep it non-windows.

>  /* Determine whether standard output is a tty or not. This is useful to 
> decide
>   * whether to use color output or not when --color option for utilities is 
> set
>   * to `auto`.
> diff --git a/lib/util.h b/lib/util.h
> index aa38122..637d0c3 100644
> --- a/lib/util.h
> +++ b/lib/util.h
> @@ -451,6 +451,7 @@ ovs_u128_and(const ovs_u128 a, const ovs_u128 b)
>  }
>  
>  void xsleep(unsigned int seconds);
> +void xusleep(unsigned int microseconds);
>  
>  bool is_stdout_a_tty(void);
_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to