GNU bug report logs - #63311
30.0.50; [PATCH] smtpmail-send-it split

Previous Next

Package: emacs;

Reported by: Manuel Giraud <manuel <at> ledu-giraud.fr>

Date: Fri, 5 May 2023 15:10:01 UTC

Severity: wishlist

Tags: patch

Found in version 30.0.50

Full log


Message #26 received at 63311 <at> debbugs.gnu.org (full text, mbox):

From: Manuel Giraud <manuel <at> ledu-giraud.fr>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 63311 <at> debbugs.gnu.org
Subject: Re: bug#63311: 30.0.50; [PATCH] smtpmail-send-it split
Date: Thu, 11 May 2023 22:59:20 +0200
Eli Zaretskii <eliz <at> gnu.org> writes:

>> From: Manuel Giraud <manuel <at> ledu-giraud.fr>
>> Cc: 63311 <at> debbugs.gnu.org
>> Date: Wed, 10 May 2023 13:47:11 +0200
>> 
>> So I guess, my question is how does one mix Lisp thread with
>> unwind-protect?
>
> I'm not sure I understand why you need to.  The two unwind-protect
> handlers will run at different times and most probably will need to
> unwind different stuff, although there could be overlap.  So why is it
> a problem to have two separate unwind forms?

I was not talking about two separate unwind forms.  I was talking about
*thread* and unwind.  Here is a minimal example that exhibits my
problem:

--8<---------------cut here---------------start------------->8---
(setq-local lexical-binding t)

(defun my-problem ()
  (interactive)
  (let ((buf (generate-new-buffer "*foo*")))
    (with-current-buffer buf
      (insert "secret message"))
    (unwind-protect
	(make-thread #'(lambda ()
			 (with-current-buffer buf
			   (sit-for 10)
			   (message (buffer-string)))))
      (kill-buffer buf))))
--8<---------------cut here---------------end--------------->8---

The thread won't have a chance to do its job since the buffer will
already be dead.
-- 
Manuel Giraud




This bug report was last modified 1 year and 220 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.