On Sun, July 19, 2020 06:05, Otto Moerbeek wrote:
> On Sat, Jul 18, 2020 at 09:31:46PM -0000, Dimitri Karamazov wrote:
>
>
>> On Sat, July 18, 2020 18:52, Otto Moerbeek wrote:
>>
>>>
>>> this is an old System V idiom. See e.g. 
>>> https://man7.org/linux/man-pages/man3/sigset.3.html
>>>
>>> -Otto
>>>
>>>
>>>
>> This compiled fine, but fine is it?
>>
>>
>> #include <signal.h>
>>
>>
>> static void increase_verbosity(int signum) {
>> verbosity++; cerr << "Increased verbosity to " << verbosity << endl; }
>>
>>
>> static void decrease_verbosity(int signum) {
>> verbosity--; cerr << "Decreased verbosity to " << verbosity << endl; }
>>
>>
>> struct sigaction inc_action { .sa_handler = increase_verbosity,
>> .sa_flags = 0
>> };
>> struct sigaction dec_action { .sa_handler = decrease_verbosity,
>> .sa_flags = 0
>> };
>>
>>
>>
>> void install_verbosity_control_signal_handlers() {
>> sigaction(SIGUSR1, &inc_action, NULL); sigaction(SIGUSR2, &dec_action, 
>> NULL); }
>>
>>
>>
>
> I'd just use signal(3).
>
>
> -Otto
>
>
Hey thanks for the suggestion, that greatly simplied the issue.

Reply via email to