emacs-devel
[Top][All Lists]
Advanced

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

Re: multi-threaded Emacs


From: Giuseppe Scrivano
Subject: Re: multi-threaded Emacs
Date: Mon, 08 Dec 2008 00:51:04 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux)

Stefan Monnier <address@hidden> writes:

>
> Switching the value of specpdl is not enough.  Try
>
> (progn
>   (run-in-thread a-thread '(dotimes (i 2)
>                          (print "hello")
>                          (yield)))
>
>     (let ((i 5))
>       (while (< i 7)
>         (print "world")
>         (yield)
>         (setq i (1+ i))))
>
> What Richard suggests is that upon a thread-switch we walk up the specpdl
> stack, undoing all the bindings, then switch specpdl to the one of the
> other thread and walk down that one to reestablish the local bindings of
> the new thread.

It is exactly what I do in save_thread_bindings () and
restore_thread_bindings ().

Trying your code (plus initializing the thread and another ')' at the
end) I have:

(progn
 (run-in-thread a-thread '(dotimes (i 2)
                        (print "hello")
                        (yield)))

   (let ((i 5))
     (while (< i 7)
       (print "world")
       (yield)
       (setq i (1+ i)))))

"hello"

"world"

"hello"

"world"


Regards,
Giuseppe




reply via email to

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