From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Po Lu Newsgroups: gmane.emacs.devel Subject: Re: Concurrency via isolated process/thread Date: Sat, 08 Jul 2023 19:54:59 +0800 Message-ID: <87h6qefwj0.fsf@yahoo.com> References: <871qhnr4ty.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> <87edljhmjq.fsf@yahoo.com> <87fs5zbuwn.fsf@localhost> <871qhjgrku.fsf@yahoo.com> <831qhieumz.fsf@gnu.org> <87lefqg7yl.fsf@yahoo.com> <83h6qed8kw.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="8723"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: yantar92@posteo.net, emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Jul 08 13:56:24 2023 Return-path: 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 ) id 1qI6Y3-000234-VB for ged-emacs-devel@m.gmane-mx.org; Sat, 08 Jul 2023 13:56:24 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qI6X2-0004IH-TP; Sat, 08 Jul 2023 07:55:20 -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 ) id 1qI6Wy-0004I2-Ew for emacs-devel@gnu.org; Sat, 08 Jul 2023 07:55:17 -0400 Original-Received: from sonic302-21.consmr.mail.ne1.yahoo.com ([66.163.186.147]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qI6Wv-0001Aj-AE for emacs-devel@gnu.org; Sat, 08 Jul 2023 07:55:15 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1688817310; bh=U4eU5u2Osuq9v/Tunvivu+qIjoRkt6vTwjB9+Ao5JKk=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From:Subject:Reply-To; b=r0tHUIgRVwHl+qWQnYLPiit+URoijJ1vadaALueMm+OIqt7j5x3rWcA6/TQGh8sZH9a2blc72+bRQrJ0BNt0KMqtW3vUgos1ZxtCnBu5CBXs0tIPiHvnFiRsLV7UB+LmFhbU4xildtU7xFjP0/yz5Dq529X9EhBKcCJZOnLV5wC58Cmjn0mQ5dgvCLF0POC/AGzJxDMP2Kt15lZi5SjaT7TrNtDhwJYSThyWe7IXXC6jKiOFF6ItzxffDxzu95eUaaOCrQiRjfIXrq1dmrGW67xC+ScTa1VxPAmVVUOlvgybToqWHa6fIQQDPMAL28EEYp2pZJQ1TZfbLjxp9ukfBg== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1688817310; bh=K2S0xKbkq1sb3sahUmXgOzqN8lhnM4uT16Dykw6EPwU=; h=X-Sonic-MF:From:To:Subject:Date:From:Subject; b=rYDmn3gwKfoxJdJCq1Evry2FZVPzN7kf9byP6DQiK6rK2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y19HN2y01DwowM8QHmVjhUpnlgxbM9r8A3Yb4dF743putY_HkS_UW MmmhuFjQ9hNUOXG2cX1_kzcr7ODfORu5AkZ7L9r7Gg X-Sonic-MF: X-Sonic-ID: 7b8bec57-a609-43d8-888c-df51cc8ebfb4 Original-Received: from sonic.gate.mail.ne1.yahoo.com by sonic302.consmr.mail.ne1.yahoo.com with HTTP; Sat, 8 Jul 2023 11:55:10 +0000 Original-Received: by hermes--production-sg3-67fd64777-8smhp (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID 9b8eef3dcf8410bd97b28401baf3a5ac; Sat, 08 Jul 2023 11:55:04 +0000 (UTC) In-Reply-To: <83h6qed8kw.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 08 Jul 2023 13:02:55 +0300") 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.186.147; envelope-from=luangruo@yahoo.com; helo=sonic302-21.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." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-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:307612 Archived-At: Eli Zaretskii writes: > Great! that means in practice no existing Lisp program could ever run > in a non-main thread. It isn't a very practical solution. Number and text crunching tasks (think Semantic, or JSON parsing for LSP) don't need to sleep or read keyboard input. > Besides, non-main threads do sometimes legitimately need to prompt > the user. It is not a programmer's error when they do. They should then devise mechanisms for communicating with the main thread. > I don't think such a simplistic solution suits a program such as > Emacs. It is the only possible solution, as long as Emacs wants to keep working with other window systems. Even our limited threads cannot work with NS and GTK in their present state: the toolkit aborts or enters an inconsistent state the instant a GUI function is called from a thread other than the main thread. > Fixed how? By replacing `sit-for' with `sleep-for' (and in general avoiding functions that call redisplay or GUI functions.) > The above doesn't do any editing, it just accesses buffer text without > changing it. I intended to include ``changing point'' in my definition of ``modifying the buffer''. > Why are we talking about multiple threads at all? don't we want to > allow some Lisp code run from non-main threads? That code will have to be specifically written for running outside the main thread, of course, obviating the need to rewrite all of our existing code. > Using a snapshot of some global resource, such as buffer text, works > only up to a point, and basically prohibits many potentially > interesting uses of threads. That's because such snapshotting assumes > no significant changes happen in the original objects while processing > the snapshot, and that is only sometimes true. We could also allow Lisp to lock a buffer by hand.