From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f65.google.com (mail-wm0-f65.google.com [74.125.82.65]) by dpdk.org (Postfix) with ESMTP id D3F2C5F3D for ; Thu, 29 Mar 2018 23:24:17 +0200 (CEST) Received: by mail-wm0-f65.google.com with SMTP id l201so12949297wmg.0 for ; Thu, 29 Mar 2018 14:24:17 -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=ksG+aylGREmA8BySn+ymcCZQAx4CSzFVYNZ9GHtukb7Mn4LMohki21mcqHtWRd2yxQ LGBGzjyaz8FdLRYhNGF5t/lSDzwKF7gxdRud1EIBCmZCoOEPQl60aoQVNigBqwfZpL8W vreUqvxJJ3YMD7k0WKEnD1+2kq+nHsYqzwvZdVj+wasavGwERgXyMOk23bMEg7T0lVG8 Qcew+bPwwQCD/G8JWCIMdtcy+8ByvZuIsIlZu0DMVeY/05dy/kFSV6sbELYNS24Hs3Vv DLhEiVenfTmMlyPjp0chdGhQl1DL1xtLfSPK0io5Knrr5gFqy1wlZqaeg3vbAuxWd6q9 sKww== 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=b466UyRfZx9C04BFbexASgs9JeFKJQvHif9iQl1mMS0UCMnnLtUzzEuN2RqNWJVck9 5bG4fV2AGwqdjXoz/MQ7bndgmU8QWTxzzYh9xWI2Rt0WR537T0ybQC9QO8UFBOtX6FEO Ahq/qMNxPSk8iVqc1q039X4+OUC57n11Ttr92dyWv5alhOyQepl1gbhlAectw2LpspJf t7iUbF3HgwxuRpIrC/DQumZx0t6VOE9czzNiWCHRJUyFy5les7wssE/j6Qpj6z9C6QC8 m7Cul6Gi48ZAjxxIPJskuaujOnS+wj9ED73S6K0QqR0FIBYTiR5mCXyUr0r0km/o7W2I 7Dfw== X-Gm-Message-State: AElRT7FMMS92EgCYcYk3R/y1Vp/5Sa+ZLCykh10Ei40NGvGSzEjCACDX Ls6Ng3G1Y86J4k0XC2EtA6qlhALA X-Google-Smtp-Source: AIpwx4+gCCcwY/nxkMWMRA1mdYddqOZ5I92thLW5Rc+M3+wcsOBXqfuCz3y7Sjz4VkFIKksigr+W2w== X-Received: by 10.28.19.13 with SMTP id 13mr422744wmt.89.1522358657216; Thu, 29 Mar 2018 14:24:17 -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 m35sm11907457wrm.59.2018.03.29.14.24.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 29 Mar 2018 14:24:16 -0700 (PDT) From: Gaetan Rivet To: dev@dpdk.org Cc: Gaetan Rivet Date: Thu, 29 Mar 2018 23:23:27 +0200 Message-Id: X-Mailer: git-send-email 2.11.0 In-Reply-To: References: In-Reply-To: References: Subject: [dpdk-dev] [PATCH v4 03/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: Thu, 29 Mar 2018 21:24:18 -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