From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Tom Tromey Newsgroups: gmane.emacs.devel Subject: Re: threads and kill-buffer Date: Wed, 05 Sep 2012 19:53:23 -0600 Message-ID: <87sjavor1o.fsf@fleche.redhat.com> References: <87a9x55xvd.fsf@fleche.redhat.com> <83d321dvsr.fsf@gnu.org> <87mx148sao.fsf@gnu.org> <834nnce8bs.fsf@gnu.org> <87627s8lcp.fsf@gnu.org> <87txvcs2f7.fsf@uwakimon.sk.tsukuba.ac.jp> <87bohkp5tz.fsf@fleche.redhat.com> <87mx14rogr.fsf@uwakimon.sk.tsukuba.ac.jp> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1346896415 6777 80.91.229.3 (6 Sep 2012 01:53:35 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 6 Sep 2012 01:53:35 +0000 (UTC) Cc: sds@gnu.org, emacs-devel@gnu.org To: "Stephen J. Turnbull" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Sep 06 03:53:37 2012 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1T9RHl-00070K-1y for ged-emacs-devel@m.gmane.org; Thu, 06 Sep 2012 03:53:37 +0200 Original-Received: from localhost ([::1]:46327 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T9RHi-0007JV-1f for ged-emacs-devel@m.gmane.org; Wed, 05 Sep 2012 21:53:34 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:41183) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T9RHf-0007JF-57 for emacs-devel@gnu.org; Wed, 05 Sep 2012 21:53:31 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T9RHe-0000O4-66 for emacs-devel@gnu.org; Wed, 05 Sep 2012 21:53:31 -0400 Original-Received: from mx1.redhat.com ([209.132.183.28]:28869) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T9RHd-0000Ne-To; Wed, 05 Sep 2012 21:53:30 -0400 Original-Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q861rQKt026614 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 5 Sep 2012 21:53:27 -0400 Original-Received: from barimba (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q861rN1a009421 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Wed, 5 Sep 2012 21:53:24 -0400 X-Attribution: Tom In-Reply-To: <87mx14rogr.fsf@uwakimon.sk.tsukuba.ac.jp> (Stephen J. Turnbull's message of "Thu, 06 Sep 2012 09:20:52 +0900") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2 (gnu/linux) X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.132.183.28 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 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-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:153084 Archived-At: Tom> No, it really is impossible in the context of Emacs, even with Tom> preemptive threads. The impossibility lies in the "GCd and reallocated" Tom> step. If thread A has a handle on the buffer, then it cannot be GCd. Stephen> Ah you're right. ... but subtract GC, and just have the buffer Stephen> reallocated in thread B, and guess what happens?[1] Subtracting GC doesn't make sense, since we're only talking about Emacs here. Stephen> So I didn't get it right, and you miss things, too. Sure, I do, but not this: Stephen> Footnotes: Stephen> [1] enlarge_buffer_text() @ buffer.c, ~l.4819. Things like this are why the threading implementation is cooperative. But actually, even that is too strong. I think the implementation only has to be cooperative as far as the C code in Emacs is concerned; and that it can appear to be preemptive from the Lisp VM perspective. Task switching during I/O is a step in that direction. Full preemption at the C level is a harder proposition. I don't intend to work on that. Tom