From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Joris Vankerschaver Newsgroups: gmane.emacs.devel Subject: Two questions about atexit cleanup in dynamic modules Date: Fri, 7 Apr 2017 09:51:14 +0100 Message-ID: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=f403045f16526b9696054c8fbacb X-Trace: blaine.gmane.org 1491555142 19443 195.159.176.226 (7 Apr 2017 08:52:22 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 7 Apr 2017 08:52:22 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Apr 07 10:52:13 2017 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cwPch-0003LU-Tr for ged-emacs-devel@m.gmane.org; Fri, 07 Apr 2017 10:52:04 +0200 Original-Received: from localhost ([::1]:49569 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cwPco-0003Xo-0L for ged-emacs-devel@m.gmane.org; Fri, 07 Apr 2017 04:52:10 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:49972) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cwPby-0003Vm-13 for emacs-devel@gnu.org; Fri, 07 Apr 2017 04:51:19 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cwPbx-0003wy-1q for emacs-devel@gnu.org; Fri, 07 Apr 2017 04:51:18 -0400 Original-Received: from mail-wr0-x235.google.com ([2a00:1450:400c:c0c::235]:34272) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cwPbw-0003wF-Qh for emacs-devel@gnu.org; Fri, 07 Apr 2017 04:51:16 -0400 Original-Received: by mail-wr0-x235.google.com with SMTP id t20so97437844wra.1 for ; Fri, 07 Apr 2017 01:51:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=3ctfyZ0KeG+q4AnFUFKHyh7ZjuavJMXzmInXXPys4to=; b=kgIorcTVzKHYFlYc4KM9eWM0fV1GXfIQmRp3L5aN+uGL+ga8se9ENVtkfcTNOXsB6O 2NdJTCzd0kvuClS2gTk/RRMn2E6nt7+u7UlbsJAWcSCWAGaDERr7qqpuH0gGozQ8gdel uQ2A3vWUKXHRpszmUuaWyixl4ogZtbo0VaqQnhebeKwUca8XsXVlED830COHijSZwq07 lsPLG3EtQci+KpToJv0UkGVuiP16QMi60KcCAN0c2/a0IbmXvLUx4SSvaEsWOxHANjum DvHKqtUbjYOw7lTg4KVy6Fqle5iC4a+pze//BHuc9A+eeJWqigjnCfkLUrkcDZtCYOAX Ip+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=3ctfyZ0KeG+q4AnFUFKHyh7ZjuavJMXzmInXXPys4to=; b=KVV15qBPt6Mr+sRpdmUVWMhkyaw9+OsEZJvOr7iyOqGImUezAO9UyVI2PSdQv2PthL xI4+esWipMwAUNbYUSHyoxnicRbt/hTXVW4rqAA1X0It1Vd4WtoGgqjtHH5L42imGi3P nHzRxD4Otd/F9wO2oyKOnqoBau7LvGH4HXl7BxTQFyinsHr2cTAfsygi7YyF7gMsxTqq u41Ti8Hf6SEPju3IkskQxM/QLsWxNEP3oJ1aGUsp7kxRKFwCTRgFBINezbfEMRRu34ae 7FwkfE/3+pvM/GUneMcFk/3pmVHiiIcuIcyvhf8LDFtdYoRANk4x06g/VbBlcIIWqMWw 9aWA== X-Gm-Message-State: AFeK/H3z3Qp6t3XuVFIrtV+U2msk/qjflo3PklIE6zDRyaEuVCcDQCYSIJXELwhotI0dEr0waJkAYQlSy9PwCw== X-Received: by 10.223.164.210 with SMTP id h18mr32244600wrb.128.1491555075198; Fri, 07 Apr 2017 01:51:15 -0700 (PDT) Original-Received: by 10.80.166.69 with HTTP; Fri, 7 Apr 2017 01:51:14 -0700 (PDT) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::235 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:213737 Archived-At: --f403045f16526b9696054c8fbacb Content-Type: text/plain; charset=UTF-8 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 --f403045f16526b9696054c8fbacb Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Hi all,

I wrote a small Emac= s dynamic module to execute Python scripts in an embedded
Python = interpreter (https://g= ithub.com/jvkersch/emacs-python). The main thing
missing is t= hat I would like to do some cleanup in the embedded Python
interp= reter 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 callbac= k
that is called when Emacs exits?

With = best wishes,
Joris
--f403045f16526b9696054c8fbacb--