[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: Sun, 30 Nov 2008 11:44:04 -0500

    (with-thread id '(code))
    (kill-thread id)

It seems to me that `with-thread' should be renamed to
`run-in-thread'.  Meanwhile, `with-thread' should be a macro that
creates a new thread, starts running the body code in it, and will
kill it when that body code finishes.

It would be cleaner to represent threads by objects that contain info
about them rather than IDs.  If there is a table of threads, it should
not have a fixed size -- it should be extensible, as many other tables
inside Emacs are.

Instead of indexing by a thread number each time you access certain
data structures, you should swap the current thread's pointers in and
out of the usual variables as part of switching threads.  That would
mean far less changes throughout the evaluator.

What should happen when another thread gets an error?  Should it run
the debugger in that thread?  (Probably rather annoying.)  Kill the
thread?  Leave the thread somehow suspended to be examined (but how?).
Kill the thread, and leave some info on the error in the dead thread object?

    I haven't well investigated all problems that will raise using threads
    in Emacs, the first one that come to my attention is the garbage
    collector and at the moment I simply disable GC while there are running

It should not be hard to find all the existing threads and mark all
their stacks.

reply via email to

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