From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f67.google.com (mail-wm0-f67.google.com [74.125.82.67]) by dpdk.org (Postfix) with ESMTP id 60A6B7CD5 for ; Tue, 27 Mar 2018 01:19:10 +0200 (CEST) Received: by mail-wm0-f67.google.com with SMTP id v21so18401126wmc.1 for ; Mon, 26 Mar 2018 16:19:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=8DgMtto7Q1uuzI12sah1IzePZlbb0fUGUr3G5asb+pg=; b=N1SfWXf/y8ws/Ky+y1fLBG37GTRAGR9QXV5RCKI3rVqETHFOuG8dXoDm7ToWKUPYLO lbKdZHX4eMaj6w2OMHWJ6gwihRfe8/rS/Lk5xwXCe2IlWTDgYp9an6RiwnR9RlUtXCpn HwDiH4y7Mv1caxWSNoyvbSNtU0cijAl05R/DxEHMYslfmffPwzQeR8mULQCkO4LerCtQ RuAhtoZxsm8xRsRSiKuz2l+bJdfu4ghHzMG2ukfz5pt5QMF2MlZlAP7BO/n9NUtd9S6U jT+4EFa7P62CT87y9m2l8WspYfX7QoJsPJU6Rtd6yHogiQRqIzn8WEv0l3BXRbJw9Je+ mYAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=8DgMtto7Q1uuzI12sah1IzePZlbb0fUGUr3G5asb+pg=; b=AZYdGV8SvaZ+DoJgyKZWaQNKy2mJb98eGd/BfCRD5mZmLs68pZF+9arrY/RWT6rDXY lW7xfkPrcM35/8XzF3USyBG6hSpmdUNx7PXP1ZBxVdam5y9AR05+spoAKDp5w9djW5PI f+NtTy7+8tuYIMOxRVTq6AQJU6iKxA6Y0Xk8NpOEEgbUZ0myofiDbXYnlYsNcC3TkWJH s/tOOjWbyfvvfVnJmFPUT2e5Vw0j6zyPrWW/GEMkLgM+8GYU1jdMuqgKHTUOpw3owATK dluyd5imMEEg7BNr0hTOuCcYyCL2ZK5c9xMIKZH60wSBhzshyZJm6j6LwfZv6Hfd76nm lOIw== X-Gm-Message-State: AElRT7EKZFqYcD5CoNzdEvgFnC43M4aSTi//rAKZ3WFRUqbU1qoIqeL2 sm0oX8OabiaOdqryAEbL3we2GLIM X-Google-Smtp-Source: AG47ELuq0693rvw9QC8raXVShrWx4eph8c4gjmXnK5wwXu7PuMH3iYrPrO6FJtmyJWmbPzhvMys5fA== X-Received: by 10.28.171.131 with SMTP id u125mr15792513wme.19.1522106349688; Mon, 26 Mar 2018 16:19:09 -0700 (PDT) Received: from bidouze.dev.6wind.com. (host.78.145.23.62.rev.coltfrance.com. [62.23.145.78]) by smtp.gmail.com with ESMTPSA id 67sm343712wra.9.2018.03.26.16.19.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 26 Mar 2018 16:19:08 -0700 (PDT) From: Gaetan Rivet To: dev@dpdk.org Cc: Gaetan Rivet Date: Tue, 27 Mar 2018 01:18:28 +0200 Message-Id: <4a59f2f4238a66556764f0cba43faad0789ebeac.1522105876.git.gaetan.rivet@6wind.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: References: In-Reply-To: References: Subject: [dpdk-dev] [PATCH v3 04/20] eal: introduce dtor macros X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Mar 2018 23:19:11 -0000 Signed-off-by: Gaetan Rivet --- lib/librte_eal/common/include/rte_common.h | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/lib/librte_eal/common/include/rte_common.h b/lib/librte_eal/common/include/rte_common.h index 99a799d6d..bdccc2553 100644 --- a/lib/librte_eal/common/include/rte_common.h +++ b/lib/librte_eal/common/include/rte_common.h @@ -111,6 +111,29 @@ static void __attribute__((constructor, used)) func(void) static void __attribute__((constructor(RTE_PRIO(prio)), used)) func(void) /** + * Run after main() with high priority. + * + * The destructor will be run *before* prioritized destructors. + * + * @param func + * Destructor function name. + */ +#define RTE_FINI(func) \ +static void __attribute__((destructor, used)) func(void) + +/** + * Run after main() with low priority. + * + * @param func + * Destructor function name. + * @param prio + * Priority number must be above 100. + * Lowest number is the last to run. + */ +#define RTE_FINI_PRIO(func, prio) \ +static void __attribute__((destructor(RTE_PRIO(prio)), used)) func(void) + +/** * Force a function to be inlined */ #define __rte_always_inline inline __attribute__((always_inline)) -- 2.11.0