all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Tom Tromey <tom@tromey.com>
To: Michael Albinus <michael.albinus@gmx.de>
Cc: Tom Tromey <tom@tromey.com>, emacs-devel@gnu.org
Subject: Re: Return value of finished threads
Date: Sat, 21 Jul 2018 12:16:26 -0600	[thread overview]
Message-ID: <878t644fph.fsf@tromey.com> (raw)
In-Reply-To: <87zhykbqve.fsf@gmx.de> (Michael Albinus's message of "Sat, 21 Jul 2018 16:33:25 +0200")

>> I was wondering which semantics would be preferred here.
>> Having each thread-join return the same result doesn't seem so bad either.

Michael> I have no strong preference. But returning the result only once has the
Michael> advantage, that you could remove all thread data from a dead thread,
Michael> once the result has been shown.

I think it's somewhat better to keep the value.  This avoids races or
the need for an extra rendezvous of some kind if there are multiple
joiners.

Keeping the value does mean that it is not GC'd.  However, normally the
idea would be to accomplish this by forgetting the dead thread in the
first place; which I would imagine is the most normal course of action.
So I tend to think this isn't a major concern.

Michael> How long do we keep the results of dead threads, for which no
Michael> thread-join happens? Do we need a Lisp cleanup function, which purges
Michael> all dead threads results? Or does this the GC, when no Lisp object holds
Michael> the dead thread any longer?

Tom> I didn't look deeply but I think instead of mark_threads, alloc.c would
Tom> need to mark any thread it runs across; and then mark_one_thread could
Tom> handle exited threads specially.

Michael> This goes into the darkness I'm not familiar with.

Good news -- it turns out I was mistaken about this.

The ordinary Lisp_Object fields of a thread are marked by mark_object,
because it is a pseudovector.  The other fields are what are marked
specially by mark_threads -- and these only need to be marked for live
threads.

I think a documentation update and a NEWS entry would be required.

thanks,
Tom



  reply	other threads:[~2018-07-21 18:16 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-20 14:56 Return value of finished threads Michael Albinus
2018-07-20 15:08 ` Eli Zaretskii
2018-07-20 15:15   ` Michael Albinus
2018-07-20 16:17     ` Clément Pit-Claudel
2018-07-20 17:25       ` Eli Zaretskii
2018-07-20 16:17 ` Noam Postavsky
2018-07-20 17:31   ` Eli Zaretskii
2018-07-21  9:28     ` Michael Albinus
2018-07-20 18:14 ` Tom Tromey
2018-07-21  9:39   ` Michael Albinus
2018-07-21 13:07     ` Tom Tromey
2018-07-21 13:16       ` Michael Albinus
2018-07-21 14:19         ` Tom Tromey
2018-07-21 14:33           ` Michael Albinus
2018-07-21 18:16             ` Tom Tromey [this message]
2018-07-21 19:33               ` Michael Albinus
2018-07-21 21:39                 ` Tom Tromey
2018-07-22 10:02                   ` Michael Albinus
2018-07-21 22:49         ` Brett Gilio
2018-07-22  2:18           ` Tom Tromey
2018-07-23 18:02             ` Brett Gilio

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=878t644fph.fsf@tromey.com \
    --to=tom@tromey.com \
    --cc=emacs-devel@gnu.org \
    --cc=michael.albinus@gmx.de \
    /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.