Gregory Stark <stark@enterprisedb.com> writes:
> "Tom Lane" <tgl@sss.pgh.pa.us> writes:
>> ISTM that there will be more cases like this in future, so we need a
>> general solution anyway. I propose the following sort of code structure
>> for these situations:
> [We would also have to block SIGTERM around the second cancel_shmem_exit and
> cleanup_routine, no? Or if it's idempotent (actually, wouldn't it have to be?)
> run them in the reverse order.]
No, we wouldn't, because a SIGTERM can only actually fire at a
CHECK_FOR_INTERRUPTS() call. You'd just need to be sure there wasn't
one in the cleanup code.
> Are all the known cases LWLocks?
*None* of the known cases are LWLocks, nor any other resource that we
have generic cleanup code for. The problem cases are one-off resources
that it seemed we could avoid having a real cleanup mechanism for.
regards, tom lane