#define REGISTER_BUILD_OPTS(str) \
INITCALL2(STG_REGISTER, hap_register_build_opts, (str), 0)
+/* simplified way to declare a post-check callback in a file */
+#define REGISTER_POST_CHECK(fct) \
+ INITCALL1(STG_REGISTER, hap_register_post_check, (fct))
+
+/* simplified way to declare a post-deinit callback in a file */
+#define REGISTER_POST_DEINIT(fct) \
+ INITCALL1(STG_REGISTER, hap_register_post_deinit, (fct))
+
+/* simplified way to declare a per-thread init callback in a file */
+#define REGISTER_PER_THREAD_INIT(fct) \
+ INITCALL1(STG_REGISTER, hap_register_per_thread_init, (fct))
+
+/* simplified way to declare a per-thread deinit callback in a file */
+#define REGISTER_PER_THREAD_DEINIT(fct) \
+ INITCALL1(STG_REGISTER, hap_register_per_thread_deinit, (fct))
+
#endif /* _TYPES_GLOBAL_H */
/*
INITCALL1(STG_REGISTER, sample_register_convs, &conv_kws);
-__attribute__((constructor))
-static void __51d_init(void)
-{
- hap_register_post_check(init_51degrees);
- hap_register_post_deinit(deinit_51degrees);
-}
-
+REGISTER_POST_CHECK(init_51degrees);
+REGISTER_POST_DEINIT(deinit_51degrees);
REGISTER_BUILD_OPTS("Built with 51Degrees support.");
__attribute__((constructor))
static void __check_init(void)
{
- hap_register_post_check(start_checks);
-
pool_head_email_alert = create_pool("email_alert", sizeof(struct email_alert), MEM_F_SHARED);
pool_head_tcpcheck_rule = create_pool("tcpcheck_rule", sizeof(struct tcpcheck_rule), MEM_F_SHARED);
}
+REGISTER_POST_CHECK(start_checks);
/*
* Local variables:
/* Initialize the trash buffers. It returns 0 if an error occurred. */
int init_trash_buffers(int first)
{
- if (!first) {
- hap_register_per_thread_init(init_trash_buffers_per_thread);
- hap_register_per_thread_deinit(deinit_trash_buffers_per_thread);
- }
pool_destroy(pool_head_trash);
pool_head_trash = create_pool("trash",
sizeof(struct buffer) + global.tune.bufsize,
return diff;
}
+REGISTER_PER_THREAD_INIT(init_trash_buffers_per_thread);
+REGISTER_PER_THREAD_DEINIT(deinit_trash_buffers_per_thread);
+
/*
* Local variables:
* c-indent-level: 8
INITCALL1(STG_REGISTER, sample_register_convs, &conv_kws);
-__attribute__((constructor))
-static void __da_init(void)
-{
- hap_register_post_check(init_deviceatlas);
- hap_register_post_deinit(deinit_deviceatlas);
-}
-
+REGISTER_POST_CHECK(init_deviceatlas);
+REGISTER_POST_DEINIT(deinit_deviceatlas);
REGISTER_BUILD_OPTS("Built with DeviceAtlas support.");
dns_resolution_pool = create_pool("dns_resolution", sizeof(struct dns_resolution), MEM_F_SHARED);
cfg_register_postparser("dns runtime resolver", dns_finalize_config);
- hap_register_post_deinit(dns_deinit);
}
+
+REGISTER_POST_DEINIT(dns_deinit);
fd_cache.first = fd_cache.last = -1;
update_list.first = update_list.last = -1;
- hap_register_per_thread_init(init_pollers_per_thread);
- hap_register_per_thread_deinit(deinit_pollers_per_thread);
for (p = 0; p < global.maxsock; p++) {
HA_SPIN_INIT(&fdtab[p].lock);
return 1;
}
+REGISTER_PER_THREAD_INIT(init_pollers_per_thread);
+REGISTER_PER_THREAD_DEINIT(deinit_pollers_per_thread);
+
/*
* Local variables:
* c-indent-level: 8
__filters_init(void)
{
pool_head_filter = create_pool("filter", sizeof(struct filter), MEM_F_SHARED);
- hap_register_post_check(flt_init_all);
- hap_register_per_thread_init(flt_init_all_per_thread);
- hap_register_per_thread_deinit(flt_deinit_all_per_thread);
}
__attribute__((destructor))
pool_destroy(pool_head_filter);
}
+REGISTER_POST_CHECK(flt_init_all);
+REGISTER_PER_THREAD_INIT(flt_init_all_per_thread);
+REGISTER_PER_THREAD_DEINIT(flt_deinit_all_per_thread);
+
/*
* Local variables:
* c-indent-level: 8
INITCALL1(STG_REGISTER, cli_register_kw, &cli_kws);
-__attribute__((constructor))
-static void __log_init(void)
-{
- hap_register_per_thread_init(init_log_buffers_per_thread);
- hap_register_per_thread_deinit(deinit_log_buffers_per_thread);
-}
+REGISTER_PER_THREAD_INIT(init_log_buffers_per_thread);
+REGISTER_PER_THREAD_DEINIT(deinit_log_buffers_per_thread);
+
/*
* Local variables:
* c-indent-level: 8
__attribute__((constructor))
static void __h1_init(void)
{
- hap_register_post_deinit(__h1_deinit);
pool_head_h1c = create_pool("h1c", sizeof(struct h1c), MEM_F_SHARED);
pool_head_h1s = create_pool("h1s", sizeof(struct h1s), MEM_F_SHARED);
}
+
+REGISTER_POST_DEINIT(__h1_deinit);
+
/*
* Local variables:
* c-indent-level: 8
__attribute__((constructor))
static void __h2_init(void)
{
- hap_register_post_deinit(__h2_deinit);
pool_head_h2c = create_pool("h2c", sizeof(struct h2c), MEM_F_SHARED);
pool_head_h2s = create_pool("h2s", sizeof(struct h2s), MEM_F_SHARED);
}
+
+REGISTER_POST_DEINIT(__h2_deinit);
INITCALL1(STG_REGISTER, sample_register_convs, &conv_kws);
-__attribute__((constructor))
-static void __wurfl_init(void)
-{
- hap_register_post_check(ha_wurfl_init);
- hap_register_post_deinit(ha_wurfl_deinit);
-}
-
// WURFL properties wrapper functions
static const char *ha_wurfl_get_wurfl_root_id (wurfl_handle wHandle, wurfl_device_handle dHandle)
{
return ((ha_wurfl_header_t *)wh)->header_value;
}
+REGISTER_POST_CHECK(ha_wurfl_init);
+REGISTER_POST_DEINIT(ha_wurfl_deinit);
REGISTER_BUILD_OPTS("Built with WURFL support.");