From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: User interaction from multiple threads Date: Sat, 01 Sep 2018 21:55:14 +0300 Message-ID: <83ftyt120d.fsf@gnu.org> References: <838t59j821.fsf@gnu.org> <837ekicw7i.fsf@gnu.org> <877ekiierh.fsf@himinbjorg.adminart.net> <834lflb2fj.fsf@gnu.org> <83h8jk9l41.fsf@gnu.org> <8336v2994c.fsf@gnu.org> <83bm9q6x7v.fsf@gnu.org> <874lfi863s.fsf@himinbjorg.adminart.net> <83va7x5guc.fsf@gnu.org> <871sakl97g.fsf@himinbjorg.adminart.net> <8336uz6e8e.fsf@gnu.org> <877ekbego9.fsf@himinbjorg.adminart.net> <83mut73vau.fsf@gnu.org> <87lg8qqh9n.fsf@himinbjorg.adminart.net> <83mut52o8g.fsf@gnu.org> <877ek9oscr.fsf@himinbjorg.adminart.net> <83o9dk0xu0.fsf@gnu.org> <87in3rmpis.fsf@himinbjorg.adminart.net> NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1535828020 22128 195.159.176.226 (1 Sep 2018 18:53:40 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 1 Sep 2018 18:53:40 +0000 (UTC) Cc: psainty@orcon.net.nz, gazally@runbox.com, rms@gnu.org, emacs-devel-bounces+psainty=orcon.net.nz@gnu.org, emacs-devel@gnu.org To: hw Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Sep 01 20:53:35 2018 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fwB1Y-0005d0-7P for ged-emacs-devel@m.gmane.org; Sat, 01 Sep 2018 20:53:32 +0200 Original-Received: from localhost ([::1]:38134 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fwB3e-0001Lq-5d for ged-emacs-devel@m.gmane.org; Sat, 01 Sep 2018 14:55:42 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:60849) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fwB3X-0001LZ-Ru for emacs-devel@gnu.org; Sat, 01 Sep 2018 14:55:36 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fwB3U-0006SH-Hl for emacs-devel@gnu.org; Sat, 01 Sep 2018 14:55:35 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:36733) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fwB3U-0006SB-E3; Sat, 01 Sep 2018 14:55:32 -0400 Original-Received: from [176.228.60.248] (port=2675 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1fwB3O-00008O-CP; Sat, 01 Sep 2018 14:55:26 -0400 In-reply-to: <87in3rmpis.fsf@himinbjorg.adminart.net> (message from hw on Sat, 01 Sep 2018 19:32:07 +0200) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 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" Xref: news.gmane.org gmane.emacs.devel:229170 Archived-At: > From: hw > Cc: psainty@orcon.net.nz, gazally@runbox.com, rms@gnu.org, emacs-devel-bounces+psainty=orcon.net.nz@gnu.org, emacs-devel@gnu.org > Date: Sat, 01 Sep 2018 19:32:07 +0200 > > > There's very little overhead, but if you are interested in the > > details, I suggest to read thread.c. It's not a lot of code, and the > > ideas are quite simple. > > I wish I had at least 50 lifetimes so I could do more of what I would > like to do. Same here. > Would you say that when a user is writing a function that does some > string replacements within texts that are usually between 16 and > 64kB in size should use multiple threads to replace different > strings or not? Could be, if the code is written to yield from time to time. > I would expect it to be slower because of the overhead unless multiple > threads could run at the same time. Since they can't, what would be an > advantage of using multiple threads? It is advantageous if some of the threads call yielding APIs, since then other threads could run while they are waiting.