[Top][All Lists]

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

threads and kill-buffer

From: Tom Tromey
Subject: threads and kill-buffer
Date: Tue, 04 Sep 2012 14:36:22 -0600

Suppose thread T has buffer B as its current buffer, and then some other
thread evaluates (kill-buffer B).  What should happen in thread T?

I thought of a few options, but I'm not really sure which is best.

In the single-threaded case, Emacs picks some other buffer to be the
current buffer.  So, one option would be to do this in the
multi-threaded case.

As long as we assume cooperative threading, this seems reasonable
enough -- it is analogous to what would happen if a process filter were
to call kill-buffer.

However, in the long run it would be good to make threads preemptive.
In this case, it seems to me that switching the current buffer like this
would be very surprising.  (But maybe still ok?)

One idea here would be to make various operations on buffers throw an
exception if the killed buffer were used.  For example, "insert" would
do this.

One problem with this approach is that this may mean that 'let' could
now throw a "killed-buffer" exception in some cases.  This seems
moderately surprising.

Another problem with this approach is just that it is hard to implement.
I see 1085 references to 'current_buffer' in the tree, and presumably
I'd have to examine each one...

Yet another idea is to make kill-buffer refuse to do this.


reply via email to

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