On Wed, Jun 8, 2016 at 12:11 PM, Steffan Karger <stef...@karger.me> wrote:

> Sure, please tell me what to use.  I never had to deal with our
> signals before, so I simply copied this from a few lines below, where
> (as far as I could see) the did what I wanted it to do.
>
> I had already replaced this with
>
>    throw_signal_soft( SIGUSR1, "process-push-msg-failed" );
>

In this particular case both throw_signal_soft and register_signal does
almost the same thing, but the latter protects SIGTERM out of the box [*].
But, in general, its better to use register signal for setting signals
inside the context struct. That is, when all that one has is a pointer to a
context which could be in a multi_instance, or the top context of the
server or a the context of a client, throw_signal_soft may not be what one
wants.

Basically, register_signal set the signal_received member of sig in a
context, while throw_signal_soft sets the process-wide signal_received.
Both are the same for a client or for the top level context of the server.

Selva

[*] I don't prefer one over the other as both of those functions will have
to be improved up on once we have a clear plan for 'signal prioritization'

Reply via email to