Re: [HACKERS] Should we standardize on a type for signal handler flags? - Mailing list pgsql-hackers

From Tom Lane
Subject Re: [HACKERS] Should we standardize on a type for signal handler flags?
Date
Msg-id 4688.1496618801@sss.pgh.pa.us
Whole thread Raw
In response to Re: [HACKERS] Should we standardize on a type for signal handlerflags?  (Andres Freund <andres@anarazel.de>)
List pgsql-hackers
Andres Freund <andres@anarazel.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



pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: [HACKERS] Should we standardize on a type for signal handlerflags?
Next
From: Mark Kirkwood
Date:
Subject: Re: [HACKERS] logical replication - still unstable after all thesemonths