From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Mailer Newsgroups: gmane.lisp.guile.devel Subject: Re: [PATCH] At-exit hook Date: Thu, 7 Nov 2024 12:27:00 +0000 Message-ID: <20241107122700.b37d3e8d2c1c09203147117e@gmail.com> References: <20241107122308.ZnP72D00T42S6aw01nP8co@laurent.telenet-ops.be> <20241107120925.87d4b80c9f289d18eec437ad@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="21203"; mail-complaints-to="usenet@ciao.gmane.io" To: guile-devel Original-X-From: guile-devel-bounces+guile-devel=m.gmane-mx.org@gnu.org Thu Nov 07 13:26:07 2024 Return-path: Envelope-to: guile-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1t91aQ-0005N2-CE for guile-devel@m.gmane-mx.org; Thu, 07 Nov 2024 13:26:06 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t91a3-0001SI-Vj; Thu, 07 Nov 2024 07:25:44 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t91a2-0001S7-Fm for guile-devel@gnu.org; Thu, 07 Nov 2024 07:25:42 -0500 Original-Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t91a0-00006K-OU for guile-devel@gnu.org; Thu, 07 Nov 2024 07:25:42 -0500 Original-Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-4315eac969aso5375755e9.1 for ; Thu, 07 Nov 2024 04:25:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1730982339; x=1731587139; darn=gnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:to:from:date:from:to:cc:subject:date:message-id :reply-to; bh=fjh1WVfoZ7ZtH2x6PF+PMaC8wkVSr16jCdEGMfzh6AI=; b=f2t2fIGO3g8lpRGMJRpGTMSXEpWJBg3WlBuZLSfPKalHls2pvfeQJ4IYg39kJ07QZM 1IoQcw+MkeRbuk8gn0EDb0VnT2t0qk4g1Y6vXdqvPClCBdrf1M0fxm4BX1oY3wlqiPO5 GwfOSSaBsEvmWgfh85GGh7OFh4Adp40+TVjW4d42sYWENRk1F9uHPMHaCKZQFkMXq/Se dKRm8QPhfZO7lJw9kVtcuT5yyWP5KnoaeRVjbXoFAQmdhatwM6C6Fuv62Hx1fNCyi5iy 00c8qUWM65pRluY6VQAQeNlgfbfs3gr6yX+i6Em+FqFmXx2hIJIBiITxYUBPtbzYXPra OEcw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730982339; x=1731587139; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:to:from:date:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=fjh1WVfoZ7ZtH2x6PF+PMaC8wkVSr16jCdEGMfzh6AI=; b=tXSW/ULnVgVATpPq0ATGGXPXjlB+wjzFc+/aOKkFeZvNLI3MzkDWjXUoktM6aUCa/6 J0UW0w/EdPfxTTSZEkpP7hVd4Rbgleahh62IlAdfmNfvCfLBbqLIOjq3I3v9g4ubZ59a JjzGNQvA1gbQgWaNLs/c9csZ0057NCiMi9NiLCpPqV7PFoyt3bmwUtG+dLStV8SKAdjT IXhWeO4oNTiwRwXXPGbgu4YdsYYU01mAQqVegysHrlvBoVJ9lzduVonmwoGkRjzqEO9e /IG9deTdW8zZ7/A7wanCjsQGT+hoAXzsNWTQJORa8wmiwJZF3pJ+b0anX5FHcnbt9o51 2SDA== X-Gm-Message-State: AOJu0YwNW40tydPi0SVsHmyolDZXeXEgIWOY8b6FMVHrFYmZ1O8nYudK ZcCvxe9uMVqB3XSrBUzGhYFUz5Y//EwDbD/bEnH2KC0+kA/wfAv6MPtrSA== X-Google-Smtp-Source: AGHT+IHdiKTbL9zv5CaxBAqhVy2OB5w5Hj4fWuSxSOnxpUdWKQRfRRH53Kxx/doTKxpvUpQZJ/BCNw== X-Received: by 2002:a05:600c:5246:b0:431:4fbd:f571 with SMTP id 5b1f17b1804b1-432b387bf90mr11072255e9.13.1730982338628; Thu, 07 Nov 2024 04:25:38 -0800 (PST) Original-Received: from bother.homenet ([2.24.141.99]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-381eda04111sm1586740f8f.92.2024.11.07.04.25.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Nov 2024 04:25:38 -0800 (PST) Original-Received: from bother.homenet (localhost [127.0.0.1]) by bother.homenet (Postfix) with SMTP id 4FAC7266613 for ; Thu, 07 Nov 2024 12:27:00 +0000 (GMT) In-Reply-To: <20241107120925.87d4b80c9f289d18eec437ad@gmail.com> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.33; x86_64-unknown-linux-gnu) Received-SPF: pass client-ip=2a00:1450:4864:20::335; envelope-from=vine24683579@gmail.com; helo=mail-wm1-x335.google.com X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, NICE_REPLY_A=-2.588, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane-mx.org@gnu.org Original-Sender: guile-devel-bounces+guile-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.lisp.guile.devel:22763 Archived-At: On Thu, 7 Nov 2024 12:09:25 +0000 Mailer wrote: > On Thu, 7 Nov 2024 12:23:08 +0100 > Maxime Devos wrote: > > ‘atexit’ functions are run at ‘exit’. ‘exit’ can be run from signal > > handlers (*). Since the hook runs Scheme code, it could do a lot of > > AC-unsafe things, resulting in problems. > > > > (*) glibc documentation says ‘exit’ is AC-unsafe, but this is > > unsupported by POSIX AFAICT. OTOH the same applies to even ‘malloc’, > > so likely I’m looking in the wrong places. > > I think you meant async-signal-safe (AS-safe). 'exit' is not a-s-s and > cannot be called in a signal handler (for example it can flush buffers) > whereas '_exit' is a-s-s. Furthermore a registered handler cannot > itself safely call 'exit'. > > I believe the main reason that use of 'atexit' or 'on_exit' is > discouraged is that it does not handle abnormal process termination. > (Registered handlers also don't run on termination by '_exit', but that > is usually what you want.) I believe also that use of 'atexit' is discouraged in dynamically linked libraries because of the uncertain timing of the unloading of the library, but I think in fact glibc is OK with this, so I guess it may depend on your libc. Chris