emacs-devel
[Top][All Lists]
Advanced

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

Re: User interaction from multiple threads


From: Elias Mårtenson
Subject: Re: User interaction from multiple threads
Date: Fri, 24 Aug 2018 23:41:40 +0800

On Fri, 24 Aug 2018 at 19:46, Michael Albinus <address@hidden> wrote:
Eli Zaretskii <address@hidden> writes:

> The idea expressed by several people is that once you start
> interacting with some thread's prompt, the other threads are locked
> out of interaction, until the interacting thread is done with the
> series of prompts that allow it to go on with its business.

Yes. The simplest locking mechanism I could imagine is a mutex locking
such interactions. This must be used for every
echo-a-prompt-and-read-the-answer interaction by default (we shall
determine all low-level cases). And it shall be a predefined, documented
mutex, like `interaction-mutex'.

May I propose that the murex be hidden behind a function and a macro? The purpose of this would be to allow for the function to adviced by libraries that want to do something special. Something like this:

(defmacro with-prompt-interaction (&body body)
  (call-with-prompt-interaction `(lambda ()  ,@body)))

(defun call-with-prompt-interaction (fn)
  (with-mutex (interaction-mutex)
    (funcall fn)))

This would allow advices to be applied to the call-with-prompt-interaction function.

Regards,
Elias

reply via email to

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