From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 90591433E5; Mon, 27 Nov 2023 18:14:48 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7E190402E8; Mon, 27 Nov 2023 18:14:48 +0100 (CET) Received: from mail-pf1-f177.google.com (mail-pf1-f177.google.com [209.85.210.177]) by mails.dpdk.org (Postfix) with ESMTP id 982EB402A3 for ; Mon, 27 Nov 2023 18:14:47 +0100 (CET) Received: by mail-pf1-f177.google.com with SMTP id d2e1a72fcca58-6cbb71c3020so3787951b3a.1 for ; Mon, 27 Nov 2023 09:14:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1701105286; x=1701710086; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=GvDFTU3au0X/aBUkQANsMmzxwG5txewJbV+sQHHuF/g=; b=q25fitYWlVYMQNgz02b+24ALl7HZPjrOEocbXpx/NXx9mtmiPCLkyhYWys4MROJTkF jsLiPZZjrR//Wl52E/1wO0eCIJb6aJXfXvdAyJs/N+3oX9Lg1/hftFLRM6tVGRrGyxP/ 4UTFDKn81/0T+PsDvIrMkntHKxqprjb6XgK6meuEzC42kQ9XY0P0cOUcCPVu6e5IU2jS c5aNUHnUGicE80nzIYVR1uizYFlFPUy8oQ3Hkz+Kw1rCkBEtDPC7t/L8F8K0HUU/jPoc qZKkxQF3E4DIOC7yaH4AO2eAE1dpBQMIlpSHBW4Jkn1E/9/EVMP2gVQ6N4H5Z9xPKAYD nVbA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701105286; x=1701710086; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=GvDFTU3au0X/aBUkQANsMmzxwG5txewJbV+sQHHuF/g=; b=OTkWI/+1teQdWRuuo4ESN9HKUZNUzihkJZipec62wR/84d4O3iCc6IW7k2dO9DHuI4 Yj1QzC0kdeyrla2LvZtBRaTK6O1Rmx86Y6mm+vcOzDwT9sXEBmjC7+yfxAeEb+92kFwN 0fBt0tA5HQwMrILxEJcqXWd8dgdWVyGoLpEHgAfgxMhYuQhR/lS2R2rALMBVUAufzhxU oJQ2qyiXvt9JFg48U3/0beglycuzEvhLn2FF7o5D9/qwXxZDto8FHHHQFMCdL3klTgJv pejQmDB8rekaBLDs75gDovAVor0JEzsJz8kYQg4AphlmVxTrZJ2yC81fR2wb9OI318Xg +u6A== X-Gm-Message-State: AOJu0YywZYCW05eQ6VM5QUzxP/RQs0Zq6OijVkyeAvsWn1g1Z1cuiFwu ihJMzjVy0An7vGJtLO2s3DaMbQ== X-Google-Smtp-Source: AGHT+IFTtBZrjkueZkf2AI62Tt2g2Mc4VfZ767LbyBNFXDdrRSDkaJkywkTGwSVHk17lIfWSC2FaNA== X-Received: by 2002:a17:903:22c9:b0:1cf:7bf7:e648 with SMTP id y9-20020a17090322c900b001cf7bf7e648mr22641232plg.33.1701105286428; Mon, 27 Nov 2023 09:14:46 -0800 (PST) Received: from hermes.local (204-195-123-141.wavecable.com. [204.195.123.141]) by smtp.gmail.com with ESMTPSA id f8-20020a17090274c800b001c9bc811d4dsm8492983plt.295.2023.11.27.09.14.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Nov 2023 09:14:46 -0800 (PST) Date: Mon, 27 Nov 2023 09:14:44 -0800 From: Stephen Hemminger To: David Vodak Cc: dev@dpdk.org Subject: Re: [PATCH] eal: introduce missing rte_thread wrappers Message-ID: <20231127091444.2d2b93c1@hermes.local> In-Reply-To: <20231127092502.18510-1-vodak@cesnet.cz> References: <20231127092502.18510-1-vodak@cesnet.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org On Mon, 27 Nov 2023 10:25:02 +0100 David Vodak 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.