bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#63311: 30.0.50; [PATCH] smtpmail-send-it split


From: Manuel Giraud
Subject: bug#63311: 30.0.50; [PATCH] smtpmail-send-it split
Date: Thu, 11 May 2023 22:59:20 +0200
User-agent: Gnus/5.13 (Gnus v5.13)

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Manuel Giraud <manuel@ledu-giraud.fr>
>> Cc: 63311@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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]