[dpdk-dev] eal: add doc for constructor macros

Message ID 20171002145925.4462-1-thomas@monjalon.net (mailing list archive)
State Accepted, archived
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Thomas Monjalon Oct. 2, 2017, 2:59 p.m. UTC
  It is a reminder that the constructors without priority
get the lowest priority.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
 lib/librte_eal/common/include/rte_eal.h | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
  

Comments

Ferruh Yigit Oct. 2, 2017, 6:57 p.m. UTC | #1
On 10/2/2017 3:59 PM, Thomas Monjalon wrote:
> It is a reminder that the constructors without priority
> get the lowest priority.
> 
> Signed-off-by: Thomas Monjalon <thomas@monjalon.net>

Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
  
Thomas Monjalon Oct. 3, 2017, 9:15 a.m. UTC | #2
02/10/2017 20:57, Ferruh Yigit:
> On 10/2/2017 3:59 PM, Thomas Monjalon wrote:
> > It is a reminder that the constructors without priority
> > get the lowest priority.
> > 
> > Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
> 
> Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>

Applied
  
John McNamara Oct. 4, 2017, 1:57 p.m. UTC | #3
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Thomas Monjalon
> Sent: Tuesday, October 3, 2017 10:15 AM
> To: dev@dpdk.org
> Cc: Yigit, Ferruh <ferruh.yigit@intel.com>
> Subject: Re: [dpdk-dev] [PATCH] eal: add doc for constructor macros
> 
> 02/10/2017 20:57, Ferruh Yigit:
> > On 10/2/2017 3:59 PM, Thomas Monjalon wrote:
> > > It is a reminder that the constructors without priority get the
> > > lowest priority.
> > >
> > > Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
> >
> > Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
> 

Acked-by: John McNamara <john.mcnamara@intel.com>
  

Patch

diff --git a/lib/librte_eal/common/include/rte_eal.h b/lib/librte_eal/common/include/rte_eal.h
index 0e7363d77..559d2308e 100644
--- a/lib/librte_eal/common/include/rte_eal.h
+++ b/lib/librte_eal/common/include/rte_eal.h
@@ -287,9 +287,26 @@  static inline int rte_gettid(void)
 	return RTE_PER_LCORE(_thread_id);
 }
 
+/**
+ * Run function before main() with low priority.
+ *
+ * The constructor will be run after prioritized constructors.
+ *
+ * @param func
+ *   Constructor function.
+ */
 #define RTE_INIT(func) \
 static void __attribute__((constructor, used)) func(void)
 
+/**
+ * Run function before main() with high priority.
+ *
+ * @param func
+ *   Constructor function.
+ * @param prio
+ *   Priority number must be above 100.
+ *   Lowest number is the first to run.
+ */
 #define RTE_INIT_PRIO(func, prio) \
 static void __attribute__((constructor(prio), used)) func(void)