python-postgres / be

pg-python: Execute Python 3 code from PostgreSQL functions.
Other
5 stars 2 forks source link

on_proc_exit #8

Closed jwp closed 14 years ago

jwp commented 14 years ago

Use this to support some atexit facilities. (plperl threads on hackers can be very educational)

jwp commented 14 years ago

the atexit module exposes the ability to call and clear the exit functions, so we'll just setup the on_proc_exit hook and use the standard atexit module.

jwp commented 14 years ago

Done. Introduces a new pl state: pl_terminated. Probably use this more in the future upon detection of corrupt state(unexpected longjmp's worry me).

http://github.com/jwp/pg-python/commit/45763700de80ded0bb6be25ff640f89f608e8f12

This may be a bit fragile as it relies on undocumented atexit APIs, but by using them we get to avoid creating an overriding atexit module.