BUILD: pollers: use an initcall to register the pollers
Pollers are among the few remaining blocks still using constructors
to register themselves. That's not needed anymore since the initcalls
so better turn to initcalls.
diff --git a/src/ev_epoll.c b/src/ev_epoll.c
index 1babe56..5832062 100644
--- a/src/ev_epoll.c
+++ b/src/ev_epoll.c
@@ -357,11 +357,8 @@
}
/*
- * It is a constructor, which means that it will automatically be called before
- * main(). This is GCC-specific but it works at least since 2.95.
- * Special care must be taken so that it does not need any uninitialized data.
+ * Registers the poller.
*/
-__attribute__((constructor))
static void _do_register(void)
{
struct poller *p;
@@ -388,6 +385,8 @@
p->fork = _do_fork;
}
+INITCALL0(STG_REGISTER, _do_register);
+
/*
* Local variables:
diff --git a/src/ev_evports.c b/src/ev_evports.c
index c3be00e..4d61154 100644
--- a/src/ev_evports.c
+++ b/src/ev_evports.c
@@ -402,10 +402,8 @@
}
/*
- * This constructor must be called before main() to register the event ports
- * poller.
+ * Registers the poller.
*/
-__attribute__((constructor))
static void _do_register(void)
{
struct poller *p;
@@ -431,3 +429,5 @@
p->poll = _do_poll;
p->fork = _do_fork;
}
+
+INITCALL0(STG_REGISTER, _do_register);
diff --git a/src/ev_kqueue.c b/src/ev_kqueue.c
index 1bd79fd..3bc7121 100644
--- a/src/ev_kqueue.c
+++ b/src/ev_kqueue.c
@@ -336,11 +336,8 @@
}
/*
- * It is a constructor, which means that it will automatically be called before
- * main(). This is GCC-specific but it works at least since 2.95.
- * Special care must be taken so that it does not need any uninitialized data.
+ * Registers the poller.
*/
-__attribute__((constructor))
static void _do_register(void)
{
struct poller *p;
@@ -367,6 +364,7 @@
p->fork = _do_fork;
}
+INITCALL0(STG_REGISTER, _do_register);
/*
* Local variables:
diff --git a/src/ev_poll.c b/src/ev_poll.c
index 5cfdff1..5f52262 100644
--- a/src/ev_poll.c
+++ b/src/ev_poll.c
@@ -316,11 +316,8 @@
}
/*
- * It is a constructor, which means that it will automatically be called before
- * main(). This is GCC-specific but it works at least since 2.95.
- * Special care must be taken so that it does not need any uninitialized data.
+ * Registers the poller.
*/
-__attribute__((constructor))
static void _do_register(void)
{
struct poller *p;
@@ -341,6 +338,7 @@
p->poll = _do_poll;
}
+INITCALL0(STG_REGISTER, _do_register);
/*
* Local variables:
diff --git a/src/ev_select.c b/src/ev_select.c
index 3c8471f..3880d0d 100644
--- a/src/ev_select.c
+++ b/src/ev_select.c
@@ -300,11 +300,8 @@
}
/*
- * It is a constructor, which means that it will automatically be called before
- * main(). This is GCC-specific but it works at least since 2.95.
- * Special care must be taken so that it does not need any uninitialized data.
+ * Registers the poller.
*/
-__attribute__((constructor))
static void _do_register(void)
{
struct poller *p;
@@ -325,6 +322,7 @@
p->poll = _do_poll;
}
+INITCALL0(STG_REGISTER, _do_register);
/*
* Local variables: