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

On 3 November 2015 at 05:57, John Wiegley <johnw@newartisans.com> wrote:
>>>>> Eli Zaretskii <eliz@gnu.org> writes:

> you will find among the changes a section for the ELisp manual that
> describes the features on the Lisp level. After that, src/thread.c,
> src/systhread.c, and the rest of the C-level changes, for the gory details.

> Have fun!

Thanks, Eli!  I will read through those carefully.

John