httpd-modules-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Yann Ylavic <ylavic....@gmail.com>
Subject Re: Signal-safe way to start a worker thread in each child process?
Date Tue, 02 Jun 2015 20:19:03 GMT
Hello,

On Tue, Jun 2, 2015 at 9:15 PM, Jacob Champion <jacob.champion@ni.com> wrote:
>
> We could just call apr_setup_signal_thread() ourselves -- and doing that
> does fix the problem -- but that means that modules which are
> initialized after us will get the global protection too, which doesn't
> feel clean. So, a few questions:
>
> 1) Is creating a new thread during the child_init hook the correct way
> to ensure that each child process gets its own background thread?

I would say yes, currently, with the existing hooks (run by the
children processes)...

>
> 2) If so, is it intended behavior that Apache calls
> apr_setup_signal_thread() after the child_init hook, instead of before it?

I don't know if it's intended, but that's the current behaviour.
Maybe a new hook is needed after apr_setup_signal_thread(), that would
not be a huge change (backportable/acceptable IMHO).

A workaround today is (as you did) to use the child_init hook
registered with APR_HOOK_REALLY_LAST, so that it is called after all
the others.
Since the hook will also be called just before
apr_setup_signal_thread(), and the latter can be called multiple
times, it should work without causing any issue.

Regards,
Yann.

Mime
View raw message