From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Jimmy Yuen Ho Wong Newsgroups: gmane.emacs.devel Subject: Re: [RFC] automatically retrying network connections Date: Mon, 23 Jul 2018 00:24:19 +0100 Message-ID: References: <87sh4dfz8r.fsf@gmail.com> <87d0vfkyo1.fsf@gmx.de> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" X-Trace: blaine.gmane.org 1532301766 31803 195.159.176.226 (22 Jul 2018 23:22:46 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 22 Jul 2018 23:22:46 +0000 (UTC) Cc: Lars Ingebrigtsen , Emacs-Devel devel To: Michael Albinus Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Jul 23 01:22:42 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 1fhNgV-00088d-Ha for ged-emacs-devel@m.gmane.org; Mon, 23 Jul 2018 01:22:39 +0200 Original-Received: from localhost ([::1]:57788 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fhNia-0003hq-NT for ged-emacs-devel@m.gmane.org; Sun, 22 Jul 2018 19:24:48 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:35695) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fhNiU-0003dm-3g for emacs-devel@gnu.org; Sun, 22 Jul 2018 19:24:43 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fhNiS-0002Az-Ta for emacs-devel@gnu.org; Sun, 22 Jul 2018 19:24:42 -0400 Original-Received: from mail-it0-x229.google.com ([2607:f8b0:4001:c0b::229]:35868) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fhNiS-0002Ah-OF for emacs-devel@gnu.org; Sun, 22 Jul 2018 19:24:40 -0400 Original-Received: by mail-it0-x229.google.com with SMTP id p81-v6so1363345itp.1 for ; Sun, 22 Jul 2018 16:24:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=jzb198hwbdQKQ4+PlthrjqKziZPWoc0HJGxakphnUB4=; b=gCi5Yqi/ItU4wS+TxZhxzq+MNrDoz8vjQzII+3EzFpnwMBe3n2HPPRZEUGxyWJGfUk 7jvnNhwWmIkQ5ci5U34OmyckZcHlbBgI/hPN0L9g4QK7rW5AXJKw9lfBCrW1BzdYThcr dehTT/Ld09vJ3WjYGVADQ8XuYnIoBcyJ44+F3hStn6Cp6V01dwfxgh8KYuaaGeeuHaOJ 3B2u7KLd00a20mJ0OPvQTZrEEB77n8NmhnB7sZcfkgKGLCUF2MY3pxO/ChHhRITU9Qge 2hpFVFXBJ8etAxlAx2wGsluNNwsSE3PX9NiJCvj0ugnx4Ry6zXifU/SK6C69C5LOjW/t G4sA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=jzb198hwbdQKQ4+PlthrjqKziZPWoc0HJGxakphnUB4=; b=eov1a8DO7KpOhixmZeoz6snqPQt6zLBX6ooYoAKBmh96cQeeTaXUfB1HUEZq/mGlJ+ g3gfiNr2Jx92nBElTvgcqFUF4PuMyAPzWB8mmeTKbzEg8G7Z4F3/g3ThVlaf6rT7SUDU af3YaSZdeO9g+qDoo29E+raM+7durENKRAxx5UVP47ct1QMeeGWB0AsUdCWE0Fni9JlE JmOP64TFRj5xaYpkyjjaH9LN+A7KwPothfEhy3DxSYfsEue/6mEI8OrMN9qOLkMEdvXe vhTAH64vWCQVcupGpJR/0bHzYRvMFOJ6vzc5AD7lUHPInYlckjfj35jERtPYDO+vRYnG pVSw== X-Gm-Message-State: AOUpUlFFSZEudLWWhvxZ6SIOeJiWoaBAE5dABnJTrinf647oY3c+qZhf EcoYPGqc1NCip8WUOZBXK71U39s5ooa5zl2Yr0Y= X-Google-Smtp-Source: AAOMgpfUKqPLsksuU6hE3NXMBHFJ8NjrKSD6FcP3dNdiQ++aUneJcYZRfY4xzH163yrCbZKbs7FXy5fcHblf3PVTk6s= X-Received: by 2002:a24:8a85:: with SMTP id v127-v6mr8792876itd.98.1532301879741; Sun, 22 Jul 2018 16:24:39 -0700 (PDT) Original-Received: by 2002:a02:985d:0:0:0:0:0 with HTTP; Sun, 22 Jul 2018 16:24:19 -0700 (PDT) In-Reply-To: <87d0vfkyo1.fsf@gmx.de> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4001:c0b::229 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:227690 Archived-At: On Sun, Jul 22, 2018 at 5:44 PM, Michael Albinus wrote: > Jimmy Yuen Ho Wong writes: > >> The latter, parellel requests, and then join the results when they all >> come back. I've come up with some bastardization of MapReduce now, but >> this would be a lot nicer if Emacs had something like >> https://github.com/chuntaro/emacs-promise built in, so I can combine >> it with a generator to emulate async/await semantics. > > Emacs has threads. So you might do something like > > (let (threads result) > ;; Create a thread per request. > (setq threads > (mapcar > (lambda (request) > (make-thread > (lambda () )))) > ) > ;; Collect the results. > (thread-yield) > (dolist (thread threads result) > (setq result (cons (thread-join thread) result)))) > > Best regards, Michael. Every `thread-join` blocks, isn't it basically the same as a generator? If nobody objects, I'm just going to use a generator for now, and see if I can get the emacs-promise author to donate it to the core.