From: | Albe Laurenz <laurenz(dot)albe(at)wien(dot)gv(dot)at> |
---|---|
To: | "Craig Ringer *EXTERN*" <craig(at)2ndquadrant(dot)com>, Seref Arikan <serefarikan(at)gmail(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: How to manage shared library lifetime through C functions |
Date: | 2014-08-04 13:48:31 |
Message-ID: | A737B7A37273E048B164557ADEF4A58B17D23412@ntex2010i.host.magwien.gv.at |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Craig Ringer wrote:
> On 08/04/2014 06:31 PM, Seref Arikan wrote:
>> Thanks a lot Heikki and Albe. Exactly what I was asking for.
>> Heikki: the libraries are written in languages that have their own
>> runtime and their documentation insists that both init and dispose calls
>> are performed when used from C. PG_init() and proc_exit sounds spot on.
>
> That's usually with reference to code that might then load them again,
> such as another library. Without specifics it's hard to say.
>
> If these tools depend on the C code terminating cleanly to operate
> correctly then they'll also break if the OS crashes, the system loses
> power, etc.
>
> Exiting a program without calling cleanup is in many ways just a
> particularly friendly kind of crash, and it's often actually much more
> efficient than doing cleanup. Why neatly tidy the floor when you're
> about to demolish the house? Total waste of time.
There are valid use cases (else the function probably wouldn't exist).
I use it in oracle_fdw to gracefully close any open Oracle connections when
the process exits.
Yours,
Laurenz Albe
From | Date | Subject | |
---|---|---|---|
Next Message | Craig Ringer | 2014-08-04 14:18:47 | Re: How to manage shared library lifetime through C functions |
Previous Message | Seref Arikan | 2014-08-04 13:08:14 | Re: How to manage shared library lifetime through C functions |