From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Giuseppe Scrivano Newsgroups: gmane.emacs.devel Subject: Re: multi-threaded Emacs Date: Sun, 30 Nov 2008 23:10:12 +0100 Message-ID: <87skp87tmj.fsf@master.homenet> References: <87abbiody1.fsf@master.homenet> <877i6l5d8s.fsf@master.homenet> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1228083052 22907 80.91.229.12 (30 Nov 2008 22:10:52 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 30 Nov 2008 22:10:52 +0000 (UTC) Cc: rms@gnu.org, emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Nov 30 23:11:55 2008 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1L6uWA-0003md-Sl for ged-emacs-devel@m.gmane.org; Sun, 30 Nov 2008 23:11:55 +0100 Original-Received: from localhost ([127.0.0.1]:55795 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1L6uV0-0002EB-Qf for ged-emacs-devel@m.gmane.org; Sun, 30 Nov 2008 17:10:42 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1L6uUo-0002Ab-Ts for emacs-devel@gnu.org; Sun, 30 Nov 2008 17:10:30 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1L6uUn-0002A3-Eo for emacs-devel@gnu.org; Sun, 30 Nov 2008 17:10:30 -0500 Original-Received: from [199.232.76.173] (port=48900 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1L6uUn-00029y-B6 for emacs-devel@gnu.org; Sun, 30 Nov 2008 17:10:29 -0500 Original-Received: from averell.mail.tiscali.it ([213.205.33.55]:46715) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1L6uUj-0005OR-5E; Sun, 30 Nov 2008 17:10:25 -0500 Original-Received: from master.homenet (84.222.170.194) by averell.mail.tiscali.it (8.0.022) id 48F7489F01FCB2DE; Sun, 30 Nov 2008 23:10:20 +0100 Original-Received: from gscrivano by master.homenet with local (Exim 4.69) (envelope-from ) id 1L6uUX-0008DA-2a; Sun, 30 Nov 2008 23:10:13 +0100 In-Reply-To: (Stefan Monnier's message of "Sun, 30 Nov 2008 16:51:58 -0500") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:106344 Archived-At: Stefan Monnier writes: >> Internal data shared among threads must be accessed only inside critical >> sections in the .c code to have atomic operations on it. > > So what happens when you execute two thread both doing > > (setq a (1+ a)) > > if you only do the locking in C, that means that `setq' will be atomic > and reading `a' is atomic, but the whole increment is not atomic. > > As mentioned earlier, synchronization primitives will need to be > provided to Elisp. Yes, the locking in C is needed to make atomic Elisp primitives, it is only the first step. For atomic expressions there is need to add these functions in Elisp too that delegate the job to the C functions. Giuseppe