From: Thomas Monjalon <thomas@monjalon.net>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH] eal: add doc for constructor macros
Date: Mon, 2 Oct 2017 16:59:25 +0200 [thread overview]
Message-ID: <20171002145925.4462-1-thomas@monjalon.net> (raw)
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(+)
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)
--
2.14.1
next reply other threads:[~2017-10-02 14:59 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-02 14:59 Thomas Monjalon [this message]
2017-10-02 18:57 ` Ferruh Yigit
2017-10-03 9:15 ` Thomas Monjalon
2017-10-04 13:57 ` Mcnamara, John
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20171002145925.4462-1-thomas@monjalon.net \
--to=thomas@monjalon.net \
--cc=dev@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).