From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f66.google.com (mail-wm0-f66.google.com [74.125.82.66]) by dpdk.org (Postfix) with ESMTP id B38E01B97B for ; Wed, 11 Apr 2018 02:04:46 +0200 (CEST) Received: by mail-wm0-f66.google.com with SMTP id b127so570097wmf.5 for ; Tue, 10 Apr 2018 17:04:46 -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=Ty2OAQB3XkFutrD7fTRKLb/bbYmCHOG2KTwFM6CudAo=; b=ov3u588s462dATOIJK5loYiqYesJCdGJXTQZOeAPlVXaiuO/0mtiUP57+KTH99sv7k KpNQsx25fpjguYl/kKuW3rmZ0g5D84GgSt+B2azJQe8GTgyddqgnb36zRWiXpgtlCOnU isauXL2GwjQxs1vHr48KqKdPZ542guiG6nVUuRfF2HGtU5GKP7hi4CLqYFyEOk0A2IHP gRwV7+FTHEZitZ6ZmdQZu13sJnM9CAVFSuU7AR6hrjhEqJeEqijS1iJA/ME4W87zumh0 d8OdqVJCquy8ZKhSCZEcg84yxxVL/3/OZDZpkcnRxWQMZapKW4RmnZ3ny4ICv/9uvRK5 Z+xw== 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=Ty2OAQB3XkFutrD7fTRKLb/bbYmCHOG2KTwFM6CudAo=; b=NdSkHmEbrRcs7cxnnIHWcyCqMeNVDQZMMICv52F3NU+o1Ffz4gAjV3I28itux1ISac GhGlrpDphusMsYWk96Cqimkehe4CbxnivYyD4sYsBFz4SKklrMFQQ2MisD4EPJLs7Kxp CpVIIyKBZn/czE5YvljwkDgMcIvIYSz8cfc4NcNqFJQrqPlyZ4n2YpDMPkaB/HZBkw7G m3sVzScD2CVk3VfP/AX08Pd6UmOXZCv27QhOMI9bVzYIhL72/Upmqp6F3JN+ArYsFmOk 3gtcJVle6zP8uSIqyzpIdG1CDE4+szJSGaVBDpl+85SWAr2Ol5LqdiWy1mOpRd2k5q65 yqWw== X-Gm-Message-State: ALQs6tAWQukm35YDnHHAU6j9QfEH2oOsOvNx3AY9IIZ2q+9pf3o5jKpm 1jM44xwGrTTaEA2ZtehXUNsePneL X-Google-Smtp-Source: AIpwx4/QSjZZbYqvRJoUR7HJe8DkhAiNSXAJEfr/tlUO7fgS+kx5vfLzhGW07hqk9o3yDIsLXiap1A== X-Received: by 10.28.72.135 with SMTP id v129mr901254wma.107.1523405086133; Tue, 10 Apr 2018 17:04:46 -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 39sm7626563wry.89.2018.04.10.17.04.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 10 Apr 2018 17:04:45 -0700 (PDT) From: Gaetan Rivet To: dev@dpdk.org Cc: Gaetan Rivet Date: Wed, 11 Apr 2018 02:04:04 +0200 Message-Id: <7f878dfc882d27e6b6676c1914763ed22397c0fa.1523404469.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 v5 03/21] 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: Wed, 11 Apr 2018 00:04:47 -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 8f04518f7..f326e1c30 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