| From: | Heikki Linnakangas <hlinnaka(at)iki(dot)fi> |
|---|---|
| To: | Kirill Reshke <reshkekirill(at)gmail(dot)com> |
| Cc: | Andres Freund <andres(at)anarazel(dot)de>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org> |
| Subject: | Re: Use standard die() handler for SIGTERM in bgworkers |
| Date: | 2026-02-18 18:07:43 |
| Message-ID: | d7eb0f7d-c6e1-40d3-9373-5564ff20c27c@iki.fi |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On 18/02/2026 10:45, Kirill Reshke wrote:
> On Wed, 18 Feb 2026 at 02:18, Heikki Linnakangas <hlinnaka(at)iki(dot)fi> wrote:
>> + <para>
>> + The default signal handlers merely set interrupt flags
>> + that are processed later by <function>CHECK_FOR_INTERRUPTS()</function>.
>> + <function>CHECK_FOR_INTERRUPTS()</function> should be called in any
>> + long-running loop to ensure that the background worker doesn't prevent the
>> + system from shutting down in a timely fashion.
>> + </para>
>
> Unless you are holding LWLock (or, more generally, inside the CRIT
> section). Should we update wording for this case, or is it maybe
> already assumed in doc?
It's OK to call CHECK_FOR_INTERRUPTS() while holding locks or in a
critical section. It's a no-op in that case.
I wouldn't go into the details here on how to use
CHECK_FOR_INTERRUPTS(). It would be good to document all that somewhere,
but it should go to some more general section on how to write server C
functions as it's applicable to any C code. For background workers, I
think the above is good.
Pushed, thanks for the review!
- Heikki
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tom Lane | 2026-02-18 18:39:05 | Re: meson: Allow disabling static libraries |
| Previous Message | Nathan Bossart | 2026-02-18 18:03:19 | Re: convert SpinLock* macros to static inline functions |