Fix Windows implementation of PGSemaphoreLock.
authorTom Lane <tgl@sss.pgh.pa.us>
Thu, 10 May 2012 17:36:18 +0000 (13:36 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Thu, 10 May 2012 17:36:18 +0000 (13:36 -0400)
commit1b48f6af315e9db89aaf43e8c8c9de903294fbdf
tree358e30a37c55d3a5277f6c9a5559cdee8416246e
parent71ca53608de1763c0d82bf463580a30f634eba56
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