[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [RFC] automatically retrying network connections

From: Michael Albinus
Subject: Re: [RFC] automatically retrying network connections
Date: Sun, 22 Jul 2018 18:44:46 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

Jimmy Yuen Ho Wong <address@hidden> 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
         (lambda (request)
            (lambda () <do your request>))))
  ;; Collect the results.
  (dolist (thread threads result)
    (setq result (cons (thread-join thread) result))))

Best regards, Michael.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]