I started playing around with this branch a bit and I quickly discovered an issue. I wanted to take the opportunity of describing this issue while at the same time hopefully gain some insight into the design of the feature.
What I did was to write the following function:
(defun foo ()
(loop for i from 0 below 10
do (message (format "Message %d" i))
do (sit-for 1)))
I then started this function in a thread:
(make-thread #'foo)
What happened was that the 10 messages were printed to the *Messages* buffer without any delay between them, and then the entire Emacs session became incredibly sluggish.
Looking at the implementation of sit-for, it seems as though it ends up calling read-event on a different thread which is probably not a good idea. Is this a correct assessment?
Regards,
Elias