rendered paste bodystatic void register_hooks(apr_pool_t *p) {
ap_hook_post_config(spread_init, NULL, NULL, APR_HOOK_MIDDLE);
}
non detachable thread works, if I do a join:
static int spread_init (apr_pool_t *p, apr_pool_t *plog, apr_pool_t *ptemp, server_rec *s){
apr_status_t rv;
apr_thread_t *thd;
apr_threadattr_t *thd_attr;
rv = apr_thread_create(&thd, NULL, doit, s, p);
rv = apr_thread_join(&rv, thd); */
return DECLINED;
}
detached thread results in segfault:
static int spread_init (apr_pool_t *p, apr_pool_t *plog, apr_pool_t *ptemp, server_rec *s){
apr_status_t rv;
apr_thread_t *thd;
apr_threadattr_t *thd_attr;
apr_threadattr_create(&thd_attr, p);
apr_threadattr_detach_set(thd_attr, APR_PROC_DETACH_DAEMONIZE);
rv = apr_thread_create(&thd, threadattr, doit, s, p);
return DECLINED;
}