From mboxrd@z Thu Jan  1 00:00:00 1970
Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail
From: Po Lu <luangruo@yahoo.com>
Newsgroups: gmane.emacs.devel
Subject: Re: Concurrency via isolated process/thread
Date: Fri, 07 Jul 2023 21:35:21 +0800
Message-ID: <87edljhmjq.fsf@yahoo.com>
References: <871qhnr4ty.fsf@localhost> <83v8ezk3cj.fsf@gnu.org>
 <87v8ezpov0.fsf@localhost> <83r0pnk2az.fsf@gnu.org>
 <87pm57pns8.fsf@localhost> <87lefvp55t.fsf@yahoo.com>
 <87sfa28ura.fsf@localhost> <87cz16o8vz.fsf@yahoo.com>
 <87jzve8r4m.fsf@localhost> <871qhmo5nv.fsf@yahoo.com>
 <87bkgq8p5t.fsf@localhost> <831qhmjwk0.fsf@gnu.org>
 <875y6y8nlr.fsf@localhost> <87h6qhnalc.fsf@yahoo.com>
 <87ilax71wo.fsf@localhost> <831qhli14t.fsf@gnu.org>
 <87wmzdxewc.fsf@localhost> <83r0plgjeo.fsf@gnu.org>
 <87o7kpxapo.fsf@localhost> <83mt09gcaf.fsf@gnu.org>
 <87wmzbc3af.fsf@localhost>
Mime-Version: 1.0
Content-Type: text/plain
Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214";
	logging-data="29652"; mail-complaints-to="usenet@ciao.gmane.io"
User-Agent: Gnus/5.13 (Gnus v5.13)
Cc: Eli Zaretskii <eliz@gnu.org>,  emacs-devel@gnu.org
To: Ihor Radchenko <yantar92@posteo.net>
Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Jul 07 15:36:04 2023
Return-path: <emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org>
Envelope-to: ged-emacs-devel@m.gmane-mx.org
Original-Received: from lists.gnu.org ([209.51.188.17])
	by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
	(Exim 4.92)
	(envelope-from <emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org>)
	id 1qHlcy-0007VH-BN
	for ged-emacs-devel@m.gmane-mx.org; Fri, 07 Jul 2023 15:36:04 +0200
Original-Received: from localhost ([::1] helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <emacs-devel-bounces@gnu.org>)
	id 1qHlcc-0006xP-Q5; Fri, 07 Jul 2023 09:35:42 -0400
Original-Received: from eggs.gnu.org ([2001:470:142:3::10])
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <luangruo@yahoo.com>)
 id 1qHlcX-0006wo-Ov
 for emacs-devel@gnu.org; Fri, 07 Jul 2023 09:35:41 -0400
Original-Received: from sonic317-32.consmr.mail.ne1.yahoo.com ([66.163.184.43])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <luangruo@yahoo.com>)
 id 1qHlcW-0004aI-21
 for emacs-devel@gnu.org; Fri, 07 Jul 2023 09:35:37 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048;
 t=1688736934; bh=Zrvfy7WHTSrlwn4q1oGfUm3lCjW2iAlce5beYcf8VAk=;
 h=From:To:Cc:Subject:In-Reply-To:References:Date:From:Subject:Reply-To;
 b=MkCR0pMrI1+WSLt6a+51ALslwS3quetNqQzxbDTc7GPNxzyHSFBj4BRtb396QyRYS0A5AFRLJf4zl/hljG1Dc4yK44WIPrA/wIGSX38by9g7+2FLqSayXsyRhjYnM/p0AdRVH1ggmOpllOiIA7i89k8+2GYKIbsgGi2hn9VDHluPYJ6LrIFHnL9loPDLiS5pUut3HhqZVp3kIMkTRD89pwadDFaMwQ4FeA3xvwX5XseEeUiLG/vr/JkkUumplMwyQWy4dWpCQNmtb6H/xDhEHaXTD3UWrDaXB81pHNG2+XlTG+WRsUrCNoEF/EIJgA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ZJuXSs9bFLqFhfxhTmorNcq7JC3eKqjrVmjX1xvA52JgrDLaIclkEuqOVfruYMjBe9DJ_zeCPN
 eeEmGNvHHfrVU6a_VnShy1S76HGpMsII_cmmZ_4VS4LxHSGyzq7X6aSvSpumE_QUiaKhYX_w9EqP
 cYD8S1oyBPfaYpOxBL.Jvn9WKvWec6oDMAHoRtF3wJqnUxWq.6F7hKc_LFiilbJDCUZ7eLsnwZ4S
 V2H7_6jeN2EdA2_2Y0zqfODpcqKbYk4WUg1XmNcvwiozhpbP4mdsZTIoccjT.d_49IoN2g2i4opq
 H5N8y1HMnyycbFjmCpGQ8jRyo2If7s34TYyq.iIIOF 
X-Sonic-MF: <luangruo@yahoo.com>
X-Sonic-ID: da1794ba-c9f9-4b4a-8bd7-5110b7ac28fe
Original-Received: from sonic.gate.mail.ne1.yahoo.com by
 sonic317.consmr.mail.ne1.yahoo.com with HTTP; Fri, 7 Jul 2023 13:35:34 +0000
Original-Received: by hermes--production-sg3-67fd64777-z82qw (Yahoo Inc. Hermes SMTP
 Server) with ESMTPA ID fc9ae178ab864a9073b6155a40147103; 
 Fri, 07 Jul 2023 13:35:28 +0000 (UTC)
In-Reply-To: <87wmzbc3af.fsf@localhost> (Ihor Radchenko's message of "Fri, 07
 Jul 2023 12:30:16 +0000")
X-Mailer: WebService/1.1.21638
 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.yahoo
Received-SPF: pass client-ip=66.163.184.43; envelope-from=luangruo@yahoo.com;
 helo=sonic317-32.consmr.mail.ne1.yahoo.com
X-Spam_score_int: -20
X-Spam_score: -2.1
X-Spam_bar: --
X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001,
 RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001,
 T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no
X-Spam_action: no action
X-BeenThere: emacs-devel@gnu.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Emacs development discussions." <emacs-devel.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/emacs-devel>,
 <mailto:emacs-devel-request@gnu.org?subject=unsubscribe>
List-Archive: <https://lists.gnu.org/archive/html/emacs-devel>
List-Post: <mailto:emacs-devel@gnu.org>
List-Help: <mailto:emacs-devel-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/emacs-devel>,
 <mailto:emacs-devel-request@gnu.org?subject=subscribe>
Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org
Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org
Xref: news.gmane.io gmane.emacs.devel:307572
Archived-At: <http://permalink.gmane.org/gmane.emacs.devel/307572>

Ihor Radchenko <yantar92@posteo.net> writes:

> AFAIU, current_buffer might be made thread-local and

It _is_ thread local.

> interrupt_input_blocked is more tricky. But it is just one global state
> variable. Surely we can find a solution to make it work with multiple threads.

interrupt_input_blocked should only be relevant to the thread reading
input, i.e. the main thread.

The problem with buffer modification lies in two threads writing to the
same buffer at the same time, changing not only the buffer text, but
also PT, ZV, GPT, its markers and its overlay lists.  No two threads may
be allowed to modify the buffer simultaneously.