emacs-devel
[Top][All Lists]
Advanced

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

Re: run-with-timer vs run-with-idle-timer


From: João Távora
Subject: Re: run-with-timer vs run-with-idle-timer
Date: Thu, 10 May 2018 13:28:20 +0100

Hi Thien,

I probably should have mentioned I'm setting up an RPC protocol.

I'm using throw/catch because there are lambdas setup inside that
block (but outside the while t). Inside the lambda is the throw. 
I then store these lambdas in a global CONTINUATIONS var that the 
process filter looks up and calls if appropriate. The infloop breaks then. 

It's much harder (and much less efficient at first sight) to do it by polling
CONDITION, but I may be missing something. Let me know 
if you want to look at a concrete example of the lambda strategy.

BTW I learned this strategy reading SLIME, I just simplified it when lexical 
binding came along. It's been working there and in other projects for 
a long time.

João


On Thu, May 10, 2018 at 12:46 PM, Thien-Thi Nguyen <address@hidden> wrote:

() João Távora <address@hidden>
() Wed, 09 May 2018 18:34:41 +0100

   (while t..) spin is a common way to wait for async conditions

Why not check the condition directly, i.e., s/t/CONDITION/ like:

 (while CONDITION
   (accept-process-output ...))

That is more precise, no?  Another idea, if there is some
expected traffic, is to use ‘(accept-process-output ...)’
directly as (or as part of) CONDITION, using its return value.

--
Thien-Thi Nguyen -----------------------------------------------
 (defun responsep (query)
   (pcase (context query)
     (`(technical ,ml) (correctp ml))
     ...))                              748E A0E8 1CB8 A748 9BFA
--------------------------------------- 6CE4 6703 2224 4C80 7502




--
João Távora

reply via email to

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