[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Elisp concurrency (was: Re: slow SMTP send blocks emacs)
At Tue, 23 Mar 2010 16:23:35 +0000,
Richard Lewis wrote:
>
> At Tue, 23 Mar 2010 11:55:38 -0400,
> David Abrahams wrote:
> >
> > For things entirely in elisp, there's always run-with-idle-timer.
> >
> (see http://www.gnu.org/s/emacs/manual/html_node/elisp/Idle-Timers.html)
>
> So, do people write code which uses this to implement concurrency? It
> sounds pretty hard, but possibly like quite a fun hack.
>
> I guess you'd need to have some sort of procedure chunker (easy with a
> recusrive or iterative procedure, harder if its time consumption is in
> IO). And then maybe set up an idle timer which executes chunks of your
> waiting procedure whenever emacs has nothing else to do.
>
> I can imagine the scheduling being reasonably easy to implement, and
> to impelement at a good level of abstraction. But I can imagine that
> it would also need some interface for executing parts of procedures
> which any user of this idle time scheduling system would have to fit
> their time-consuming procedure into. That sounds hard.
It's awkward, but *usually* not too hard; start by translating the
process into a state machine, I think.
http://www.emacswiki.org/emacs/ConcurrentEmacs
--
Dave Abrahams Meet me at BoostCon: http://www.boostcon.com
BoostPro Computing
http://www.boostpro.com