emacs-devel
[Top][All Lists]
Advanced

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

Re: Crashing the new thread code


From: Juliusz Chroboczek
Subject: Re: Crashing the new thread code
Date: Sun, 11 Dec 2016 23:56:19 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux)

> I would expect the thread to receive the signal as soon as it starts
> running again.

I'm not sure what the semantics of signal-thread is supposed to be.  The
manual says:

    ‘thread-signal’ will cause a thread to exit a call to ‘mutex-lock’,
    ‘condition-wait’, or ‘thread-join’.

I assumed this to mean that the condition will only be delivered when
one of these functions is called, but your comment seems to imply that
it's meant to deliver the condition as soon as possible.

Which makes sense, but gives a whole new flavour to using unwind-protect
now that conditions can be signalled asynchronously.

(Aside: I'm actually not quite sure in that case that unwind-protect can
be used safely at all.  What happens if a condition is signalled during
the cleanup?  Say:

    (let ((foo nil))
      (unwind-protect
           (progn
             (setq foo (make-foo))
             (do-stuff-with foo))
        (when foo (destroy-foo foo))))

if a condition is signalled just before the cleanup but after exiting
the body, will we leak a foo?  End of aside.)

-- Juliusz




reply via email to

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