emacs-devel
[Top][All Lists]
Advanced

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

Re: semantics of thread-signal


From: Juliusz Chroboczek
Subject: Re: semantics of thread-signal
Date: Mon, 12 Dec 2016 02:21:38 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux)

>> 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.

> My interpretation is that mutex-lock (and the others) block the thread
> until something happens (e.g., another thread calls mutex-unlock), and
> thread-signal is another thing which can end the blocking (and also
> trigger a signal when the thread next runs).

Reasonable enough.  Perhaps somebody could clarify the docs?

>> if a condition is signalled just before the cleanup but after exiting
>> the body, will we leak a foo?

> This can't happen, because thread are cooperative.

The manual says:

    However, the Emacs thread support has been designed in a way to
    later allow more fine-grained concurrency, and correct programs
    should not rely on cooperative threading.

So if thread-signal can be delivered asynchronously, this will cause
trouble when Emacs moves to kernel threads.

(And this does happen.  Viz. SBCL, CCL, ACL, all of which switched from
userspace threading to kernel threads sometime in the last 20 years or
so.)

-- Juliusz




reply via email to

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