all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Juliusz Chroboczek <jch@irif.fr>
To: emacs-devel@gnu.org
Subject: Re: semantics of thread-signal
Date: Mon, 12 Dec 2016 02:21:38 +0100	[thread overview]
Message-ID: <871sxe2b8d.fsf@irif.fr> (raw)
In-Reply-To: CAM-tV-9q_9pZuH4VQ0EeJ4NX1fudy9cZWepu9vrn7koN7U--YA@mail.gmail.com

>> 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	other threads:[~2016-12-12  1:21 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-12  0:16 semantics of thread-signal (WAS: Crashing the new thread code) Noam Postavsky
2016-12-12  1:21 ` Juliusz Chroboczek [this message]
2016-12-12  2:06   ` semantics of thread-signal Noam Postavsky
2016-12-12 16:08     ` Eli Zaretskii
2016-12-13  2:46       ` Noam Postavsky
2016-12-12  3:33   ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=871sxe2b8d.fsf@irif.fr \
    --to=jch@irif.fr \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.