On Sat, 23 Sept 2023 at 20:09, Dmitry Gutov<dmitry@gutov.dev> wrote:
I agree: functions like yes-or-no-p will have to, internally in their
implementation, acquire the "redisplay lock" or whatever it'll be
called, and do other things to ensure that they work from non-default
threads too.
That’s not the only possible implementation. A function that wants a
confirmation could package up the prompt with a continuation function,
and post that as a message to the main thread. The main thread would
pump its message queue, display the prompt, and schedule the
continuation (with the prompt result) to a worker thread.
That would require the code using prompt functions to be transformed
to continuation-passing style though, either explicitly in code, or
automatically by the lisp reader.