From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Ken Raeburn Newsgroups: gmane.emacs.devel Subject: Re: Threading IO-bound functions Date: Fri, 16 Dec 2016 17:05:36 -0500 Message-ID: <83637909-4303-471C-8CED-9BF0377554F9@raeburn.org> References: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1481925954 22292 195.159.176.226 (16 Dec 2016 22:05:54 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 16 Dec 2016 22:05:54 +0000 (UTC) Cc: emacs-devel To: =?utf-8?Q?Elias_M=C3=A5rtenson?= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Dec 16 23:05:51 2016 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 1cI0dP-0004bZ-PX for ged-emacs-devel@m.gmane.org; Fri, 16 Dec 2016 23:05:48 +0100 Original-Received: from localhost ([::1]:34502 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cI0dU-0004po-5g for ged-emacs-devel@m.gmane.org; Fri, 16 Dec 2016 17:05:52 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:48766) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cI0dO-0004la-DI for emacs-devel@gnu.org; Fri, 16 Dec 2016 17:05:47 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cI0dK-0000AD-Ab for emacs-devel@gnu.org; Fri, 16 Dec 2016 17:05:46 -0500 Original-Received: from mail-qt0-x241.google.com ([2607:f8b0:400d:c0d::241]:34031) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cI0dJ-00007D-TB for emacs-devel@gnu.org; Fri, 16 Dec 2016 17:05:42 -0500 Original-Received: by mail-qt0-x241.google.com with SMTP id l20so12420073qta.1 for ; Fri, 16 Dec 2016 14:05:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raeburn-org.20150623.gappssmtp.com; s=20150623; h=subject:mime-version:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=IWLb4N5igr6tFKdrfAlRDexmUlC4uZjo1mzxL6Rdla8=; b=t62VJC/9iPQ6gJdHmkDY3cQLlWp2kiQXcAgNFQSTkxV+i37nNjAn4e+ZkQ9shRBsLB L9tUS3MFiVKKP6Py/XLztrhWz+16i/FYdjDeFzLLBZMhWc+0RkbV5C89d6pdL+wneaxS aOdmuxVNEJpkU0gqgatGV6oZA44Xip/jt/3q4QjD0X00HCxfKVStbzev/KA/yuGlrhsL qQyXGVeImGE/JeSXjn/lix5SzoGB5qcxGMmKAUoIld8onSEZhip48naQAyqGUcqEGuZJ O/ilMyBt8uwbIPeJnMTeyIMHTBocreUQZxdc4oqI3v6QJRQ2HcCWeIKcVAcIHMZFRSQo rITw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:mime-version:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=IWLb4N5igr6tFKdrfAlRDexmUlC4uZjo1mzxL6Rdla8=; b=FoIC9/UyDJlHe780ja2UkwYMtMfQXe7Kt2dQPzdwXt1+Ts0x2n8oFpsnH4oJ6i5Ls7 Ri6OAYldPetwWpP98Ih4ZNgbNvOO2dxMi9gi3sKqdFctJArGmwN8yB6SiVXrRwIcf3ts KQSZ7bJ67zlDonrwhTQJbEzK3at2SfzNOsri82hOf98qQoaKRhe1cuhONhZyfKlFTIV4 KzXdPkS18UnTntcMZCbI+VP6sDKLkf4vOyVI6/1qJD0hqefx/ZcDUrL+GbZwgbEoSTpE aTmAl1BnuGc3wcGT3eLzR/AH/ccYEZdVjSm+hJ5ysopZvlyr9q+HUPMj5Ye9+MEoZqeu paYg== X-Gm-Message-State: AIkVDXLsTgcOONoJUbKxmZ5QFWkthCKeuxjKlIZb4DfDqVmC6d4VX7CnPfymSNhZgA9PBQ== X-Received: by 10.200.51.148 with SMTP id c20mr4717796qtb.228.1481925939343; Fri, 16 Dec 2016 14:05:39 -0800 (PST) Original-Received: from [192.168.23.52] (c-50-138-183-136.hsd1.ma.comcast.net. [50.138.183.136]) by smtp.gmail.com with ESMTPSA id 29sm4705372qtu.21.2016.12.16.14.05.37 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 16 Dec 2016 14:05:37 -0800 (PST) In-Reply-To: X-Mailer: Apple Mail (2.3124) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:400d:c0d::241 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:210549 Archived-At: On Dec 14, 2016, at 23:01, Elias M=C3=A5rtenson = wrote: > The number one function that I call that sometimes hang for a = significant amount of time is =E2=80=98gnus=E2=80=99. I decided to try = running it in a thread, and it worked surprisingly well. Initial loading = of the messages can now be done in the background. I=E2=80=99m a bit surprised=E2=80=A6 pleased, but surprised=E2=80=A6 :-) >=20 > To prevent myself from running this function more than once at the = same time, I created a wrapper function for this, and I have extracted = it into a macro. >=20 > I'd like to have people's opinions on this strategy, and if it might = be reasonable to default =E2=80=98gnus=E2=80=99 to do this when run on = Emacs versions with concurrency support. For a few things I think it might be reasonable. But with something = like Gnus, there are many things one might want to do in background = (fetch the initial list of newsgroups and article counts, update that = list, fetch article lists when entering a newsgroup), and =E2=80=94 just = generally speaking =E2=80=94 each of them has to lock out all the = others, lest they stomp on each others=E2=80=99 data structures. The one advantage the =E2=80=9Cgnus=E2=80=9D command has, specifically, = compared to the whole rest of Gnus, is that it can do the initial = setting up of those data structures. If the group buffer isn=E2=80=99t = ready for command input (what key bindings are applicable at that = point?), it=E2=80=99s harder to trigger other Gnus commands to run. Though, what about sending email with message mode? If I use a = =E2=80=9CGcc:=E2=80=9D header to save sent emails in an IMAP folder, = what happens if Gnus is only part-way set up? When do gnus-demon timers get set up? Can they fire before gnus is = ready? Etc=E2=80=A6. Ken=