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:26:41
Message-ID: 4688.1496618801@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:
> On 2017-06-04 19:14:06 -0400, Tom Lane wrote:
>> 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?

> Well, we already have some variables that aren't actually booleans,
> although I think all of them are only read not manipulated in signal
> handlers (InterruptHoldoffCount etc).

Hm. Well, according to POSIX one may rely on sig_atomic_t being able
to hold the values 0..127 on all platforms. So we might be able to
get away with converting InterruptHoldoffCount to sig_atomic_t if we
needed to. In the absence of evidence that we need to, I wouldn't.
But I have no problem with standardizing on using sig_atomic_t for
variables that are assigned to by signal handlers.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Mark Kirkwood 2017-06-05 01:08:12 Re: logical replication - still unstable after all these months
Previous Message Andres Freund 2017-06-04 23:21:39 Re: Should we standardize on a type for signal handler flags?