Re: Interrupting long external library calls

From: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
To: Mark Cave-Ayland <mark(dot)cave-ayland(at)ilande(dot)co(dot)uk>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Interrupting long external library calls
Date: 2012-05-16 16:30:03
Message-ID: 4FB3D60B.8040702@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 16.05.2012 15:42, Sandro Santilli wrote:
> But CHECK_FOR_INTERRUPTS doesn't return, right ?
> Is there another macro for just checking w/out yet acting upon it ?

Hmm, no. CHECK_FOR_INTERRUPTS() checks the InterruptPending variable,
but on Windows it also checks for UNBLOCKED_SIGNAL_QUEUE(). And even if
InterruptPending is set, it's not totally certain that
CHECK_FOR_INTERRUPTS() won't return. I think InterruptPending can be set
spuriously (even if that's not possible today, I wouldn't rely on it),
and if you're in a HOLD/RESUME_INTERRUPTS block, CHECK_FOR_INTERRUPTS()
will do nothing even if InterruptPending is true.

The only sane way to make 3rd party code interruptible is to add
CHECK_FOR_INTERRUPTS() to it, in safe places.

--
Heikki Linnakangas
EnterpriseDB http://www.enterprisedb.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Stephen Frost 2012-05-16 17:03:57 Re: Pre-alloc ListCell's optimization
Previous Message Stephen Frost 2012-05-16 16:24:39 Re: Pre-alloc ListCell's optimization