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:09:25 +0000 Message-ID: <20241107120925.87d4b80c9f289d18eec437ad@gmail.com> References: <20241107122308.ZnP72D00T42S6aw01nP8co@laurent.telenet-ops.be> 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="29373"; 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:08:37 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 1t91JV-0007TB-6F for guile-devel@m.gmane-mx.org; Thu, 07 Nov 2024 13:08:37 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t91J5-0006Sz-JC; Thu, 07 Nov 2024 07:08:11 -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 1t91J2-0006SX-Vz for guile-devel@gnu.org; Thu, 07 Nov 2024 07:08:10 -0500 Original-Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t91J1-0004YK-90 for guile-devel@gnu.org; Thu, 07 Nov 2024 07:08:08 -0500 Original-Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-43167ff0f91so7764245e9.1 for ; Thu, 07 Nov 2024 04:08:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1730981285; x=1731586085; 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=klUwLyrH3PQNbYL+QSMkUXWhuXEmeDxzSWJoCPkDCFI=; b=D9V9oWVttKY6d1YtBy+yhzsIDDK6oas3VyPnyGScMv3kGK8HuEClrox/X3Au7pRUzw AfNvjqMx5/8iBmMnzSe9zlf9GQ+2ix2rIjwpNLFiBz6uwd/qTETwdtwSBGghaCHGoxea b1cePzq3jXoTRBvs9wjlmkSTg+CLR1BBslV9tikgjMcJFx7YL/mMRLjtUc3YmFzcB5p0 VSGa3rn2Tb3/pulluL1UxSP/k8xf9GRDUcK8JdzEwoEpSMjNY6WLDizIjuAwqM0DWAVk am6ox0/pa0PmzfLrikwajyW6/9S2qYdIhjuR6jyRcGMfyC69bpN3IhYWTsvFgOiy1S48 hIkA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730981285; x=1731586085; 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=klUwLyrH3PQNbYL+QSMkUXWhuXEmeDxzSWJoCPkDCFI=; b=vCZOBPRHFjiSir9I5mXbxaP+3tWQKi0ueho3iAV1nsP5UKnJi4W7yvxFVt3w0VxEb3 kyGbsFhLM6fleVcNCX7WKNSf4h34B4le2Z3EmNDOMqZjmychNMvVQ1yTb3sTr50Lpoy3 2YpKuD5srjI60j81GnwJkWHfxyvuKo+p7DPfw1Fw1p5M4wjl1jKH4wPouMqTUsrcr5LE SCt36K5cQHeTfsk15z4pJfH1+vMuQNI7qOGMIVjdeaJEDRlmA2/OEl7eexlIjOfW35eX QuXrBnqCrVkwEoMPEnuBSKieDppbBpOLApjBc72Cedp2k7AdNhCMhoZGsu7Ilhwqo3Z7 8PIg== X-Gm-Message-State: AOJu0YwOhKMhA7Lz5qaUhZrM9QS9oGXY+SgrDsDvQLFbLmZGKSqUEFJ4 C2+OZk4xcH0hvfWmbChahhOWL6KrTp8Y04YJLgIhmpbdujNMeHiAlzOUAQ== X-Google-Smtp-Source: AGHT+IGcxAIOWqviz9aWCFWi9JIHDIETyErXlrOUHZ2NP6uE0YImMdGpYlAot74sHJcd0zrYSRKXGg== X-Received: by 2002:a5d:64e9:0:b0:37e:d719:89d3 with SMTP id ffacd0b85a97d-381ef73119fmr777415f8f.51.1730981284591; Thu, 07 Nov 2024 04:08:04 -0800 (PST) Original-Received: from bother.homenet ([2.24.141.99]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-381eda036afsm1593345f8f.86.2024.11.07.04.08.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Nov 2024 04:08:04 -0800 (PST) Original-Received: from bother.homenet (localhost [127.0.0.1]) by bother.homenet (Postfix) with SMTP id 8DD86266613 for ; Thu, 07 Nov 2024 12:09:25 +0000 (GMT) In-Reply-To: <20241107122308.ZnP72D00T42S6aw01nP8co@laurent.telenet-ops.be> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.33; x86_64-unknown-linux-gnu) Received-SPF: pass client-ip=2a00:1450:4864:20::329; envelope-from=vine24683579@gmail.com; helo=mail-wm1-x329.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:22761 Archived-At: 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.) Chris