[ovs-dev] [PATCH] fatal-signal: Run signal hooks outside of actual signal handlers.

Ben Pfaff blp at nicira.com
Fri Dec 11 17:46:01 UTC 2009


Oh, a few more things:

> -/* Number of nesting signal blockers. */
> -static int block_level = 0;
> -
> -/* Signal mask saved by outermost signal blocker. */
> -static sigset_t saved_signal_mask;
> +/* Signal that was received and will be processed next poll loop iteration. */
> +static sig_atomic_t stored_sig_nr = -1;

'stored_sig_nr' should be "volatile" since it's accessed from a
signal handler.

Also, sig_atomic_t is allowed to be an unsigned integer type,
which means that it will always compare as different from -1
later on.  SIG_ATOMIC_MAX (from <stdint.h>) is probably a better
value to use.

But if you use a pipe you probably won't need this variable at
all.




More information about the dev mailing list