From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: SAKURAI Masashi Newsgroups: gmane.emacs.devel Subject: Re: threads and kill-buffer Date: Wed, 05 Sep 2012 12:49:15 +0900 Message-ID: <201209050351.q853pKIX011625@ms-omx11.plus.so-net.ne.jp> References: <87a9x55xvd.fsf@fleche.redhat.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII X-Trace: ger.gmane.org 1346817094 18338 80.91.229.3 (5 Sep 2012 03:51:34 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 5 Sep 2012 03:51:34 +0000 (UTC) Cc: emacs-devel@gnu.org To: tromey@redhat.com Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Sep 05 05:51:36 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 1T96eN-0001yG-Ki for ged-emacs-devel@m.gmane.org; Wed, 05 Sep 2012 05:51:35 +0200 Original-Received: from localhost ([::1]:44558 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T96eK-0000u9-KH for ged-emacs-devel@m.gmane.org; Tue, 04 Sep 2012 23:51:32 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:55824) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T96eI-0000ty-1G for emacs-devel@gnu.org; Tue, 04 Sep 2012 23:51:30 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T96eG-0007Ag-Qe for emacs-devel@gnu.org; Tue, 04 Sep 2012 23:51:29 -0400 Original-Received: from ms-omx11.so-net.ne.jp ([202.238.84.161]:38833) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T96eG-0007AS-AX for emacs-devel@gnu.org; Tue, 04 Sep 2012 23:51:28 -0400 Original-Received: from liza2.kiwanami.net (EM117-55-68-178.emobile.ad.jp [117.55.68.178]) (authenticated) by ms-omx11.plus.so-net.ne.jp with ESMTP id q853pKIX011625; Wed, 5 Sep 2012 12:51:24 +0900 In-Reply-To: <87a9x55xvd.fsf@fleche.redhat.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) Emacs/23.4 Mule/6.0 (HANACHIRUSATO) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 202.238.84.161 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:153032 Archived-At: Hi Tom, > Suppose thread T has buffer B as its current buffer, and then some other > thread evaluates (kill-buffer B). What should happen in thread T? > > I thought of a few options, but I'm not really sure which is best. In java, some appropriate exception is thrown, such as InterruptedException, ConcurrentModificationException and so on. Preventing the exceptions, some thread controlling is also needed, such as monitor, semaphore, lock and so on. > Another problem with this approach is just that it is hard to implement. > I see 1085 references to 'current_buffer' in the tree, and presumably > I'd have to examine each one... I think that this discussion is very important and the first step for introducing the Emacs thread support. Before implementation, I would hope that the behavior and specifications for the language (VM) and library level should be discussed and defined well. If it has been done, I would apologize for my meddler comment. Though I have worked on development for server and client applications with Java, C and Ruby, I feel the concurrency of the design and programing is very difficult. This book is introductory and very practical, even in Java. Amazon.com: Java Concurrency in Practice: Brian Goetz, Tim Peierls, Joshua Bloch, Joseph Bowbeer, David Holmes, Doug Lea: Books http://www.amazon.com/Java-Concurrency-Practice-Brian-Goetz/dp/0321349601 In addition to the book, there are many good books for the concurrency design. The design and implementation in the other languages also may be helpful. -- SAKURAI, Masashi (family, given) m.sakurai@kiwanami.net