From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp.tuxdriver.com (charlotte.tuxdriver.com [70.61.120.58]) by dpdk.org (Postfix) with ESMTP id 42B3D4CBB for ; Thu, 22 Mar 2018 12:36:37 +0100 (CET) Received: from cpe-2606-a000-111b-40b7-640c-26a-4e16-9225.dyn6.twc.com ([2606:a000:111b:40b7:640c:26a:4e16:9225] helo=localhost) by smtp.tuxdriver.com with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.63) (envelope-from ) id 1eyyWC-0006OV-EA; Thu, 22 Mar 2018 07:36:35 -0400 Date: Thu, 22 Mar 2018 07:35:55 -0400 From: Neil Horman To: Gaetan Rivet Cc: dev@dpdk.org Message-ID: <20180322113555.GA6272@hmswarspite.think-freely.org> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.2 (2017-12-15) X-Spam-Score: -2.9 (--) X-Spam-Status: No Subject: Re: [dpdk-dev] [PATCH v2 01/18] 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, 22 Mar 2018 11:36:37 -0000 On Wed, Mar 21, 2018 at 06:15:22PM +0100, Gaetan Rivet wrote: > 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 c7803e41c..500fc3adb 100644 > --- a/lib/librte_eal/common/include/rte_common.h > +++ b/lib/librte_eal/common/include/rte_common.h > @@ -105,6 +105,29 @@ static void __attribute__((constructor, used)) func(void) > static void __attribute__((constructor(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(prio), used)) func(void) > + > +/** If you need to require that priority be above 100, you probably want to create a BUILD_BUG type macro to enforce that. Neil > * Force a function to be inlined > */ > #define __rte_always_inline inline __attribute__((always_inline)) > -- > 2.11.0 > >