* Two questions about atexit cleanup in dynamic modules
@ 2017-04-07 8:51 Joris Vankerschaver
2017-04-08 16:38 ` Philipp Stephani
0 siblings, 1 reply; 3+ messages in thread
From: Joris Vankerschaver @ 2017-04-07 8:51 UTC (permalink / raw)
To: emacs-devel
[-- Attachment #1: Type: text/plain, Size: 609 bytes --]
Hi all,
I wrote a small Emacs dynamic module to execute Python scripts in an
embedded
Python interpreter (https://github.com/jvkersch/emacs-python). The main
thing
missing is that I would like to do some cleanup in the embedded Python
interpreter when Emacs exits (close open files, deal with threads/processes,
etc). What would be the best way to do so?
1. Can I just register an atexit handler when my module starts, or will that
interfere with some Emacs internals?
2. Would it make sense to add support to the module API for a cleanup
callback
that is called when Emacs exits?
With best wishes,
Joris
[-- Attachment #2: Type: text/html, Size: 863 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Two questions about atexit cleanup in dynamic modules
2017-04-07 8:51 Two questions about atexit cleanup in dynamic modules Joris Vankerschaver
@ 2017-04-08 16:38 ` Philipp Stephani
2017-04-10 17:36 ` Joris Vankerschaver
0 siblings, 1 reply; 3+ messages in thread
From: Philipp Stephani @ 2017-04-08 16:38 UTC (permalink / raw)
To: Joris Vankerschaver, emacs-devel
[-- Attachment #1: Type: text/plain, Size: 936 bytes --]
Joris Vankerschaver <joris.vankerschaver@gmail.com> schrieb am Fr., 7. Apr.
2017 um 10:52 Uhr:
> Hi all,
>
> I wrote a small Emacs dynamic module to execute Python scripts in an
> embedded
> Python interpreter (https://github.com/jvkersch/emacs-python). The main
> thing
> missing is that I would like to do some cleanup in the embedded Python
> interpreter when Emacs exits (close open files, deal with
> threads/processes,
> etc). What would be the best way to do so?
>
> 1. Can I just register an atexit handler when my module starts, or will
> that
> interfere with some Emacs internals?
>
Unless you attempt to call Emacs functions in the atexit handler, that
should be fine.
>
> 2. Would it make sense to add support to the module API for a cleanup
> callback
> that is called when Emacs exits?
>
You can already use the hook `kill-emacs-hook' as usual. That's especially
useful if your cleanup needs to interact with Emacs.
[-- Attachment #2: Type: text/html, Size: 1938 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Two questions about atexit cleanup in dynamic modules
2017-04-08 16:38 ` Philipp Stephani
@ 2017-04-10 17:36 ` Joris Vankerschaver
0 siblings, 0 replies; 3+ messages in thread
From: Joris Vankerschaver @ 2017-04-10 17:36 UTC (permalink / raw)
To: Philipp Stephani; +Cc: emacs-devel
[-- Attachment #1: Type: text/plain, Size: 1225 bytes --]
Dear Philipp,
Many thanks for the confirmation regarding atexit, and for pointing out the
kill-emacs-hook. This is exactly what I needed!
With best wishes,
Joris
On Sat, Apr 8, 2017 at 5:38 PM, Philipp Stephani <p.stephani2@gmail.com>
wrote:
>
>
> Joris Vankerschaver <joris.vankerschaver@gmail.com> schrieb am Fr., 7.
> Apr. 2017 um 10:52 Uhr:
>
>> Hi all,
>>
>> I wrote a small Emacs dynamic module to execute Python scripts in an
>> embedded
>> Python interpreter (https://github.com/jvkersch/emacs-python). The main
>> thing
>> missing is that I would like to do some cleanup in the embedded Python
>> interpreter when Emacs exits (close open files, deal with
>> threads/processes,
>> etc). What would be the best way to do so?
>>
>> 1. Can I just register an atexit handler when my module starts, or will
>> that
>> interfere with some Emacs internals?
>>
>
> Unless you attempt to call Emacs functions in the atexit handler, that
> should be fine.
>
>
>>
>> 2. Would it make sense to add support to the module API for a cleanup
>> callback
>> that is called when Emacs exits?
>>
>
> You can already use the hook `kill-emacs-hook' as usual. That's especially
> useful if your cleanup needs to interact with Emacs.
>
[-- Attachment #2: Type: text/html, Size: 3000 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-04-10 17:36 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-04-07 8:51 Two questions about atexit cleanup in dynamic modules Joris Vankerschaver
2017-04-08 16:38 ` Philipp Stephani
2017-04-10 17:36 ` Joris Vankerschaver
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.