MINOR: thread: provide a set of lock initialisers
This patch adds ha_spin_init() and ha_rwlock_init() which are used as
a callback to initialise locks at boot time. They perform exactly the
same as HA_SPIN_INIT() or HA_RWLOCK_INIT() but from within a real
function.
diff --git a/src/hathreads.c b/src/hathreads.c
index 075866a..eb3eb59 100644
--- a/src/hathreads.c
+++ b/src/hathreads.c
@@ -92,6 +92,18 @@
thread_harmless_end();
}
+/* these calls are used as callbacks at init time */
+void ha_spin_init(HA_SPINLOCK_T *l)
+{
+ HA_SPIN_INIT(l);
+}
+
+/* these calls are used as callbacks at init time */
+void ha_rwlock_init(HA_RWLOCK_T *l)
+{
+ HA_RWLOCK_INIT(l);
+}
+
__attribute__((constructor))
static void __hathreads_init(void)
{