]> granicus.if.org Git - postgresql/commit
Use SA_RESTART for all signals, including SIGALRM.
authorTom Lane <tgl@sss.pgh.pa.us>
Sat, 15 Jun 2013 19:39:51 +0000 (15:39 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Sat, 15 Jun 2013 19:39:51 +0000 (15:39 -0400)
commit873ab97219caabeb2f7b390268a4fe01e2b7518c
treef737709ef0a7cd0ab0ac2cf371f71e12fd91df82
parent5242fefb471d1fb2d0f35a33bde3570e19acd4b1
Use SA_RESTART for all signals, including SIGALRM.

The exclusion of SIGALRM dates back to Berkeley days, when Postgres used
SIGALRM in only one very short stretch of code.  Nowadays, allowing it to
interrupt kernel calls doesn't seem like a very good idea, since its use
for statement_timeout means SIGALRM could occur anyplace in the code, and
there are far too many call sites where we aren't prepared to deal with
EINTR failures.  When third-party code is taken into consideration, it
seems impossible that we ever could be fully EINTR-proof, so better to
use SA_RESTART always and deal with the implications of that.  One such
implication is that we should not assume pg_usleep() will be terminated
early by a signal.  Therefore, long sleeps should probably be replaced
by WaitLatch operations where practical.

Back-patch to 9.3 so we can get some beta testing on this change.
src/backend/port/sysv_sema.c
src/port/pqsignal.c