Fix Windows implementation of PGSemaphoreLock.
authorTom Lane <tgl@sss.pgh.pa.us>
Thu, 10 May 2012 17:36:14 +0000 (13:36 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Thu, 10 May 2012 17:36:14 +0000 (13:36 -0400)
commitada8fa08fc6cf5f199b6df935b4d0a730aaa4fec
tree91ee17f2907ffb7def96c7d3170f2f8b5fb5d9f6
parent8ebc908c575b3378c9d4096412d16d91d107311c
Fix Windows implementation of PGSemaphoreLock.

The original coding failed to reset ImmediateInterruptOK before returning,
which would potentially allow a subsequent query-cancel interrupt to be
accepted at an unsafe point.  This is a really nasty bug since it's so hard
to predict the consequences, but they could be unpleasant.

Also, ensure that signal handlers are serviced before this function
returns, even if the semaphore is already set.  This should make the
behavior more like Unix.

Back-patch to all supported versions.
src/backend/port/win32_sema.c