All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: David Vodak <vodak@cesnet.cz>
Cc: dev@dpdk.org
Subject: Re: [PATCH] eal: introduce missing rte_thread wrappers
Date: Mon, 27 Nov 2023 09:14:44 -0800	[thread overview]
Message-ID: <20231127091444.2d2b93c1@hermes.local> (raw)
In-Reply-To: <20231127092502.18510-1-vodak@cesnet.cz>

On Mon, 27 Nov 2023 10:25:02 +0100
David Vodak <vodak@cesnet.cz> wrote:

> Function rte_ctrl_thread_create has been replaced by rte_thread_create_control,
> encouraging Linux users to switch from the pthread_t API to the rte_thread API.
> However the rte_thread API does not provide wrappers for all pthread functions.
> This commit introduces equivalent functions for pthread_timedjoin_np,
> pthread_getname_np and pthread_cancel.
> 
> Bugzilla ID: 1330
> ---
>  lib/eal/include/rte_thread.h | 49 ++++++++++++++++++++++++++++++++++++
>  lib/eal/unix/rte_thread.c    | 20 +++++++++++++++
>  lib/eal/version.map          |  3 +++
>  3 files changed, 72 insertions(+)
> 
> diff --git a/lib/eal/include/rte_thread.h b/lib/eal/include/rte_thread.h
> index 8da9d4d3fb..49a068eda7 100644
> --- a/lib/eal/include/rte_thread.h
> +++ b/lib/eal/include/rte_thread.h
> @@ -463,6 +463,55 @@ int rte_thread_value_set(rte_thread_key key, const void *value);
>   */
>  void *rte_thread_value_get(rte_thread_key key);
>  
> +/**
> + * Try to join with a terminated thread. If thread has not yet terminated,
> + * then the call blocks until a maximum time, specified in abstime.
> + *
> + * @param thread_id
> + *   Id of the thread.
> + *
> + * @param retval
> + *   Exit status of the thread.
> + *
> + * @param abstime
> + *   Maximum time of call blocking, measured against the CLOCK_REALTIME clock.
> + *
> + * @return
> + *   On success, return 0.
> + *   On failure, return a positive errno-style error number.
> + */
> +int rte_thread_timedjoin_np(rte_thread_t thread_id, void **retval, const struct timespec *abstime);
> +
> +/**
> + * Get name of the thread.
> + *
> + * @param thread_id
> + *   Id of the thread.
> + *
> + * @param name
> + *   Name of the thread.
> + *
> + * @param size
> + *   The number of bytes available in name.
> + *
> + * @return
> + *   On success, return 0.
> + *   On failure, return a positive errno-style error number.
> + */
> +int rte_thread_getname_np(rte_thread_t thread_id, char name[], size_t size);
> +
> +/**
> + * Send a cancelation request to a thread.
> + *
> + * @param thread_id
> + *   Id of the thread.
> + *
> + * @return
> + *   On success, return 0.
> + *   On failure, return a positive errno-style error number.
> + */
> +int rte_thread_cancel(rte_thread_t thread_id);

The point of the thread wrappers was to limit the use to what
was supportable on all platforms. 

  reply	other threads:[~2023-11-27 17:14 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-27  9:25 [PATCH] eal: introduce missing rte_thread wrappers David Vodak
2023-11-27 17:14 ` Stephen Hemminger [this message]
2023-11-27 17:27 ` Tyler Retzlaff
2023-11-28  8:54   ` David Vodak
2023-11-29 15:52     ` Stephen Hemminger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231127091444.2d2b93c1@hermes.local \
    --to=stephen@networkplumber.org \
    --cc=dev@dpdk.org \
    --cc=vodak@cesnet.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.