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

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Andres Freund <andres(at)anarazel(dot)de>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Should we standardize on a type for signal handler flags?
Date: 2017-06-06 18:13:29
Message-ID: CA+TgmoaaQTNur+0=P47L_QL4BdGmyyG_cu+biGBpFGoQ=nxysw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Jun 6, 2017 at 1:33 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>> I think that's a pretty good argument, really. If there exists a
>> platform where only sig_atomic_t is safe to read from a signal
>> handler, then we already don't work on that platform. Even saving and
>> restoring errno isn't safe in that case.
>
> That's an argument from false premises. The question here is what types
> are safe for an interrupt handler to *change*, not what can it read.

OK, but we certainly have code in signal handlers that does:

int save_errno = errno;
/* stuff */
errno = save_errno;

If that's not a signal handler changing an int, color me confused.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2017-06-06 18:21:56 Re: intermittent failures in Cygwin from select_parallel tests
Previous Message Robert Haas 2017-06-06 18:11:06 Re: retry shm attach for windows (WAS: Re: OK, so culicidae is *still* broken)