[dpdk-dev] [PATCH v2 3/7] eal: add sleep API
Tal Shnaiderman
talshn at nvidia.com
Sun Feb 21 09:58:02 CET 2021
> Subject: [dpdk-dev] [PATCH v2 3/7] eal: add sleep API
>
> External email: Use caution opening links or attachments
>
>
> POSIX sleep(3) is missing from Windows.
> Add generic rte_thread_sleep() to suspend current OS thread.
>
> Signed-off-by: Dmitry Kozlyuk <dmitry.kozliuk at gmail.com>
> ---
> lib/librte_eal/common/eal_common_timer.c | 5 +++--
> lib/librte_eal/include/rte_thread.h | 11 +++++++++++
> lib/librte_eal/rte_eal_exports.def | 2 ++
> lib/librte_eal/unix/rte_thread.c | 10 +++++++++-
> lib/librte_eal/version.map | 3 +++
> lib/librte_eal/windows/eal_thread.c | 9 ++++++++-
> 6 files changed, 36 insertions(+), 4 deletions(-)
>
[snip]
> diff --git a/lib/librte_eal/version.map b/lib/librte_eal/version.map index
> fce90a112..106864469 100644
> --- a/lib/librte_eal/version.map
> +++ b/lib/librte_eal/version.map
> @@ -412,6 +412,9 @@ EXPERIMENTAL {
> rte_thread_tls_key_delete;
> rte_thread_tls_value_get;
> rte_thread_tls_value_set;
> +
> + # added in 21.05
Spaces, should be tab.
> + rte_thread_sleep;
> };
>
> INTERNAL {
> diff --git a/lib/librte_eal/windows/eal_thread.c
> b/lib/librte_eal/windows/eal_thread.c
> index 908e726d1..957792301 100644
> --- a/lib/librte_eal/windows/eal_thread.c
> +++ b/lib/librte_eal/windows/eal_thread.c
> @@ -11,9 +11,10 @@
> #include <rte_per_lcore.h>
> #include <rte_common.h>
> #include <rte_memory.h>
> -#include <eal_thread.h>
> +#include <rte_thread.h>
>
> #include "eal_private.h"
> +#include "eal_thread.h"
> #include "eal_windows.h"
>
> /*
> @@ -154,3 +155,9 @@ rte_thread_setname(__rte_unused pthread_t id,
> __rte_unused const char *name)
> /* This is a stub, not the expected result */
> return 0;
> }
> +
> +void
> +rte_thread_sleep(unsigned int sec)
> +{
> + return Sleep(MS_PER_S * sec);
> +}
> --
> 2.29.2
More information about the dev
mailing list