emacs-devel
[Top][All Lists]
Advanced

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

Re: "Asynchronous Requests from Emacs Dynamic Modules"


From: Akira Kyle
Subject: Re: "Asynchronous Requests from Emacs Dynamic Modules"
Date: Sun, 01 Nov 2020 13:18:40 -0700
User-agent: mu4e 1.4.13; emacs 28.0.50


On Sat, Oct 31, 2020 at 06:49 AM, Stefan Monnier <monnier@iro.umontreal.ca> wrote:

With Emacs 28, you can get a file descriptor to a pipe process and
send arbitrary data there (from arbitrary threads).

Cool, so that takes care of it.

You'd still need some small protocol (e.g. JSON) to encode/decode
requests, but with that you can send arbitrary requests
back asynchronously.

I don't think you need a complex protocol: just stash somewhere (inside the module data structures) the data you need for the async request, then send a dummy byte to the pipe. On the Lisp side, just install a process-filter which calls back the module to "run any pending async
requests".

Thanks Philipp for pointing this out! I'm glad this was already thought of and added so the SIGUSR1 hack isn't necessary going forward. For future reference, the module function is `open_channel`.



reply via email to

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