[Top][All Lists]

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

Re: Are there plans for a multi-threaded Emacs?

From: Nic Ferrier
Subject: Re: Are there plans for a multi-threaded Emacs?
Date: 30 Nov 2003 19:40:39 +0000

Kai Grossjohann <address@hidden> writes:

> Miles Bader <address@hidden> writes:
> > Consider a simple bit of elisp code:  (setq GLOBAL (cons 'x GLOBAL))
> > In a pre-emptively threaded emacs, another thread could run between
> > accessing GLOBAL and setting it.  Whoops.
> Well, I don't know a lot about threading, but Java, at least, has the
> same problem: you need to synchronize access to a variable to prevent
> such things from happening.  By default, synchronized access is turned
> off.
> So if all of what is now in Emacs continues to run in a single thread,
> and you just provide a function to create a new thread and run stuff
> in that new thread, then it would be the responsibility of the people
> creating threads to make sure that they don't step on each other's
> toes.
> Then the remaining problem is that possibly a lot of functions cannot
> be safely used because they access global variables.  But that is just
> something that people will have to live with, and maybe it will get
> better over time.  I think that it will be good enough at least for
> some packages to do part of their work in the background.
> What do people think?  Maybe I missed something obvious...

I think there are 2 big problems:

1. emacs _is_ global variables, there aren't any thread safe routines
right now because thread safety has not been an issue uptil now. So
display, buffer manipulation, everything becomes a thread problem.

2. I think dynamic scope also makes this a lot more complicated
because you're not talking about just globals anymore but variables
passed from a proc into a thread-proc and onwards. Very tricky.


reply via email to

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