From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Tom Tromey Newsgroups: gmane.emacs.devel Subject: Re: Return value of finished threads Date: Sat, 21 Jul 2018 12:16:26 -0600 Message-ID: <878t644fph.fsf@tromey.com> References: <87h8kuq7kf.fsf@gmx.de> <87h8kt3hcj.fsf@tromey.com> <87wotphqre.fsf@gmx.de> <87lga44u14.fsf@tromey.com> <874lgsivam.fsf@gmx.de> <87h8ks4qot.fsf@tromey.com> <87zhykbqve.fsf@gmx.de> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1532197062 997 195.159.176.226 (21 Jul 2018 18:17:42 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 21 Jul 2018 18:17:42 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1.50 (gnu/linux) Cc: Tom Tromey , emacs-devel@gnu.org To: Michael Albinus Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Jul 21 20:17:38 2018 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fgwRk-00008B-IN for ged-emacs-devel@m.gmane.org; Sat, 21 Jul 2018 20:17:36 +0200 Original-Received: from localhost ([::1]:53559 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fgwTr-000399-EI for ged-emacs-devel@m.gmane.org; Sat, 21 Jul 2018 14:19:47 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:49044) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fgwQt-0001xu-1u for emacs-devel@gnu.org; Sat, 21 Jul 2018 14:16:46 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fgwQp-00070A-SI for emacs-devel@gnu.org; Sat, 21 Jul 2018 14:16:43 -0400 Original-Received: from gateway30.websitewelcome.com ([192.185.145.3]:26897) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fgwQp-0006wM-GT for emacs-devel@gnu.org; Sat, 21 Jul 2018 14:16:39 -0400 Original-Received: from cm10.websitewelcome.com (cm10.websitewelcome.com [100.42.49.4]) by gateway30.websitewelcome.com (Postfix) with ESMTP id 87A353F597 for ; Sat, 21 Jul 2018 13:16:27 -0500 (CDT) Original-Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id gwQdf4RLiBcCXgwQdfj4X5; Sat, 21 Jul 2018 13:16:27 -0500 X-Authority-Reason: nr=8 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=0d4vZWwkfm4vuHr+egGeQQbzbQnY9CMYHIYPIbGK3dE=; b=WouQe60WWRaopus1fkyJbpQ7gj uOFw8DiZgSuVQcOFtREo594ZAJQweW+Oyn5aZwQTMgxwoRSqYgOmhn5nrF4/IRxt+OPkyr7VM9jSh PX0gEpad5xMbiYNuu7BQXOrfR; Original-Received: from 75-166-85-72.hlrn.qwest.net ([75.166.85.72]:54654 helo=bapiya) by box5379.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.91) (envelope-from ) id 1fgwQd-00258F-75; Sat, 21 Jul 2018 13:16:27 -0500 X-Attribution: Tom In-Reply-To: <87zhykbqve.fsf@gmx.de> (Michael Albinus's message of "Sat, 21 Jul 2018 16:33:25 +0200") X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - box5379.bluehost.com X-AntiAbuse: Original Domain - gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tromey.com X-BWhitelist: no X-Source-IP: 75.166.85.72 X-Source-L: No X-Exim-ID: 1fgwQd-00258F-75 X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 75-166-85-72.hlrn.qwest.net (bapiya) [75.166.85.72]:54654 X-Source-Auth: tom+tromey.com X-Email-Count: 2 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 192.185.145.3 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:227631 Archived-At: >> 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