From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gaetan.rivet@6wind.com>
Received: from mail-wr0-f169.google.com (mail-wr0-f169.google.com
 [209.85.128.169]) by dpdk.org (Postfix) with ESMTP id B4B711B4C1
 for <dev@dpdk.org>; Wed,  4 Jul 2018 00:15:40 +0200 (CEST)
Received: by mail-wr0-f169.google.com with SMTP id q10-v6so3379615wrd.4
 for <dev@dpdk.org>; Tue, 03 Jul 2018 15:15:40 -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=kjK0X93uJ8qR12GsXLADuXLvB/fMaIlBtKWcJvWWVLY=;
 b=VD9zsi+0FaQ4heNT1tnpBlP/SLFgMwJpl9A0IB2pGUmXDy1Ag16IAVGt4MPvSk5FL8
 vwSaDIxHYz4ExYwElpX69TyuBXwJqeS6WgTXj4/reEjRPbtB35ThlwEHbf7MugOl9gl+
 QrCA+12B+vL44PCzRWtaiZa5t3tHVg6MCzthaSpkxrVeShuODu0gRIr8Ksl0DMs6kQA/
 vvJX5pfocVOXRH53AI/b4ispy4JG55S4AAqB7/Cz3rGU2uPQLQyylsaXBii8hhYiwjWV
 mIAjk/5R1qNNB572LS4mAy+75nPoZdHMs51iMJP4q32qy2kF+t7ZLDAStciYko3rEqte
 Wfvg==
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=kjK0X93uJ8qR12GsXLADuXLvB/fMaIlBtKWcJvWWVLY=;
 b=G329vrfV+4OLJXCYg6b6HleN1oV26vIeyU0dGj3XN4ra8ITaG57KebWbwzS+54B8Ul
 6tWxTMPeKJxXPYkRHlkR9r/B+wDNwHUm6ceosM2sfGKdn6f9q8QjsrFvEgPSBqFkO1HV
 VSOUkHGKskvE/S/f6kiX1xgyJZohI+HCWGqvCuTONCzMkxmJGtp8RMINXoClogamYMcu
 fdydXHgqFwqYhnGrCn4HP/h/iU3zBCVKbb4NS6rWwDk4v5GM4nMbE9jNqZzotzUOHbXu
 7D5hr8SenYYiI5ObHHeRbSYpduNJMRDGb9Ac0EXS2eE3TvvWpBcvgmN/hSDgp1rT3byv
 ULhg==
X-Gm-Message-State: APt69E1M2RVaBbZ98xbWL/4TGcdPuI5fwjJKwg4tS2CeUKfviPdxYZV5
 aBuPO8ljFKnFRlxrAN64AwNPVGo/
X-Google-Smtp-Source: AAOMgpcVd8ncVlRBa+ueTF8edzJWdUchWQKKVw+xrh2oUa3BCaitAabZHGDjc0bZRst5IvJT5qdNJA==
X-Received: by 2002:adf:8b01:: with SMTP id
 n1-v6mr24690402wra.282.1530656140133; 
 Tue, 03 Jul 2018 15:15:40 -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 i190-v6sm3771084wmd.33.2018.07.03.15.15.38
 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
 Tue, 03 Jul 2018 15:15:39 -0700 (PDT)
From: Gaetan Rivet <gaetan.rivet@6wind.com>
To: dev@dpdk.org
Cc: Gaetan Rivet <gaetan.rivet@6wind.com>
Date: Wed,  4 Jul 2018 00:14:48 +0200
Message-Id: <1ec567e6991c4959491b9517bce926f32d03ccc8.1530655929.git.gaetan.rivet@6wind.com>
X-Mailer: git-send-email 2.11.0
In-Reply-To: <cover.1530655929.git.gaetan.rivet@6wind.com>
References: <cover.1521124599.git.gaetan.rivet@6wind.com>
 <cover.1530655929.git.gaetan.rivet@6wind.com>
In-Reply-To: <cover.1530655929.git.gaetan.rivet@6wind.com>
References: <cover.1530655929.git.gaetan.rivet@6wind.com>
Subject: [dpdk-dev] [PATCH v9 05/27] 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://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Tue, 03 Jul 2018 22:15:40 -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 434adfd45..0dd832728 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