emacs-devel
[Top][All Lists]
Advanced

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

Re: Patch for fields of `struct buffer'


From: Tom Tromey
Subject: Re: Patch for fields of `struct buffer'
Date: Tue, 08 Feb 2011 09:30:16 -0700
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux)

RMS> It would be easy enough to stop one buffer from being current in more
RMS> than one thread.  Just make set-buffer do the interlocking.  That
RMS> would be an easy change, and it would block threads less often than
RMS> the above idea.

RMS> But even that could be too much blocking of threads.  If a thread
RMS> is sitting idle with a certain buffer current, that would block
RMS> all other threads from operating on it.  That would be a big problem.

I actually tried to put a buffer lock in set-buffer and in the end
concluded that it was too much trouble.

One problem comes up immediately: what is the current buffer of a new
thread?  It can't be the parent's thread buffer, since that means new
threads won't run until the parent thread changes buffers.  And, there
is no guarantee that there is more than one buffer.

Making Emacs safe for preemptive threads is, as you say, quite hard.  It
is even hard at the micro level -- ensuring that operations like XCAR
are atomic.

Tom



reply via email to

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