I have been experimenting with the following code, run from an IELM buffer:
(make-thread (lambda ()
(sit-for 5)
(with-current-buffer "z"
(insert "foo"))))
I then keep the "z" bufer open in a different window so that I can see what is going on.
If I type this command and then wait 5 seconds, the buffer get updated just as I expect.
If I then type the same command again, Emacs crashes after 5 seconds. Sometimes I have to try more than twice to get Emacs to crash, but it will inevitably happen.
Also, when the crash doesn't happen, and I keep pressing RET after running the above form, the insert will happen after much less than 5 seconds. Sometimes it happens almost immediately. It's like sit-for actually doesn't wait the correct number of seconds, but rather will just finish as soon as control is returned to the thread.
Regards,
Elias