From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gaetan.rivet@6wind.com>
Received: from mail-wr0-f195.google.com (mail-wr0-f195.google.com
 [209.85.128.195]) by dpdk.org (Postfix) with ESMTP id E20D31B417
 for <dev@dpdk.org>; Sun, 15 Apr 2018 17:08:16 +0200 (CEST)
Received: by mail-wr0-f195.google.com with SMTP id u11so19293858wri.12
 for <dev@dpdk.org>; Sun, 15 Apr 2018 08:08:16 -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=gerWU3cf5ls8bayi2HII2hVSGyl+fhAcDFRxrjbP6iA=;
 b=xjHGCb34fb0L45aSQXE88FyxLflZmJNtT+VlGl1eWaS7WU39uVnbJ1W38nBXYIy+aX
 SsD0sdb5F1q5RI6wyhl0ZjIQ8M8PDA7I5Dfn+SXYoGUdc2bVHOWNb0VC7TmgVcgqJ9Yt
 sdl49gSSRa4rUP3PBCsKCnFVvF9AxHidi7qdHHVrmHLa/jEyNe3PwSkzMjV+8icWXDWs
 g7dD/1Gr5qY0KuH/LaKGkc/T0rHGhyqum9Lo/QgId3hyI6sWL+yvkvD9i9onInUtbpye
 bQpb8a6k7AVJGcSzxI6+JX/Wq1lZogxeznJCPUhIqS/DsO+0K13lyonXbfQ09UyHjyaS
 FVrg==
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=gerWU3cf5ls8bayi2HII2hVSGyl+fhAcDFRxrjbP6iA=;
 b=Fp2GgIhJlBrVgd9jlsW7SfQj2mJOgQd/KFeiJksgRafq1wBgKhEsccfi/yKcdvhQV0
 oYE49GPLLGIt1ISy3SjvVclBqAkHQPjGtHImOVn/deCzRh1Y0h1klJWiyHyLnspF9ilf
 fwHDb5JJNkctjyK0vd2b6IUEnGhDfE5bWpymv1rmHnmMboisSEVhaq0nOmQr1FBKCXrw
 PEhj5zIHhlju4iEA8Yl58BuW52VaOqfmqurE0TnNQc0GMQsOdrQND72EP3uuqOKHCUeR
 vV7GW1+Hnm8rYZzbHe7fvkFvU1aaBtpHVtNjxyJ/E1UHxw4f88BNp7xGKrF/x94KbQny
 ldMQ==
X-Gm-Message-State: ALQs6tC+xXdkKdKT3gMGaRcyq6/YbCWTQPpiwZYeixdct8ZWRdiBvYtw
 Ziu/c3oME51/Cm5JjoDlAb53Aamk
X-Google-Smtp-Source: AIpwx49c2roOZbBAzo9K23x+R6vXLZagqkKYYamsZ8hscQusBkm5Tr3Ju8Q5KayUIWth7C59r3ggZg==
X-Received: by 10.28.26.73 with SMTP id a70mr7669595wma.30.1523804895305;
 Sun, 15 Apr 2018 08:08:15 -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 r200sm13673438wmb.39.2018.04.15.08.08.14
 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
 Sun, 15 Apr 2018 08:08:14 -0700 (PDT)
From: Gaetan Rivet <gaetan.rivet@6wind.com>
To: dev@dpdk.org
Cc: Gaetan Rivet <gaetan.rivet@6wind.com>
Date: Sun, 15 Apr 2018 17:07:33 +0200
Message-Id: <79746db25465ac62ab7707378eb0f3e1030ac342.1523804657.git.gaetan.rivet@6wind.com>
X-Mailer: git-send-email 2.11.0
In-Reply-To: <cover.1523804657.git.gaetan.rivet@6wind.com>
References: <cover.1521124599.git.gaetan.rivet@6wind.com>
 <cover.1523804657.git.gaetan.rivet@6wind.com>
In-Reply-To: <cover.1523804657.git.gaetan.rivet@6wind.com>
References: <cover.1523804657.git.gaetan.rivet@6wind.com>
Subject: [dpdk-dev] [PATCH v7 04/22] eal: introduce dtor macros
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://dpdk.org/ml/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://dpdk.org/ml/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Sun, 15 Apr 2018 15:08:17 -0000

Signed-off-by: Gaetan Rivet <gaetan.rivet@6wind.com>
---
 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 69e5ed1e3..d48e0ec56 100644
--- a/lib/librte_eal/common/include/rte_common.h
+++ b/lib/librte_eal/common/include/rte_common.h
@@ -112,6 +112,29 @@ static void __attribute__((constructor(RTE_PRIO(prio)), used)) func(void)
 	RTE_INIT_PRIO(func, LAST)
 
 /**
+ * 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)
+
+/**
+ * Run after main() with high priority.
+ *
+ * The destructor will be run *before* prioritized destructors.
+ *
+ * @param func
+ *   Destructor function name.
+ */
+#define RTE_FINI(func) \
+	RTE_FINI_PRIO(func, LAST)
+
+/**
  * Force a function to be inlined
  */
 #define __rte_always_inline inline __attribute__((always_inline))
-- 
2.11.0