[Top][All Lists]

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

Re: multi-threaded Emacs

From: Richard M Stallman
Subject: Re: multi-threaded Emacs
Date: Sat, 06 Dec 2008 14:25:57 -0500

    It will be safe in the sense that it won't cause a crash.  But it will
    mess up Elisp's semantics.  Consider:

       (dotimes (i 1000) (toto))

    if you run this code twice in separate threads and allow context
    switches at QUIT, then you'll basically be doing "preemptive
    concurrency" seen from Elisp's point of view.  Among other things, the
    two threads will be fighting over the value of `i'.

Each thread should have its own local bindings.  To do this
requires swapping bindings in and out of the specpdls
when switching threads.  It is not hard.

This makes thread switches slower, and that makes it desirable
to do them less often.

reply via email to

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