Re: Should we standardize on a type for signal handler flags?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Should we standardize on a type for signal handler flags?
Date: 2017-06-04 23:14:06
Message-ID: 4257.1496618046@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Andres Freund <andres(at)anarazel(dot)de> writes:
> At the moment a number of flag variables set in signal handlers have
> 'volatile bool' as type, others have 'volatile sig_atomic_t'. That's
> kinda confusing. I think either is safe, but I think we should
> standardize one of them.

sig_atomic_t is more standards-conforming, I should think. I'm not sure
if there are any current platforms where a store to a char variable
wouldn't be atomic, but why live dangerously?

I'd be inclined to let the code continue to treat the variables as
if they were bool, ie store "true" and "false" not "1" and "0"
into them. That should be perfectly safe.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2017-06-04 23:21:39 Re: Should we standardize on a type for signal handler flags?
Previous Message Michael Paquier 2017-06-04 23:13:12 Re: Should we standardize on a type for signal handler flags?