On Fri, Mar 7, 2014 at 2:03 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> In the bug thread I proposed making atexit_callback check whether getpid()
> still matches MyProcPid. If it doesn't, then presumably we inherited the
> atexit callback list, along with the value of MyProcPid, from some parent
> backend process whose elbow we should not joggle. Can anyone see a flaw
> in that?
While my answer would be "not really" (lots of python libraries do the
same to handle forks), there's an optional path: pthread_atfork.