unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* threads and kill-buffer
@ 2012-09-04 20:36 Tom Tromey
  2012-09-04 20:43 ` Lars Ingebrigtsen
                   ` (5 more replies)
  0 siblings, 6 replies; 58+ messages in thread
From: Tom Tromey @ 2012-09-04 20:36 UTC (permalink / raw)
  To: Emacs discussions

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.

Tom



^ permalink raw reply	[flat|nested] 58+ messages in thread

end of thread, other threads:[~2012-09-08 19:45 UTC | newest]

Thread overview: 58+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-04 20:36 threads and kill-buffer Tom Tromey
2012-09-04 20:43 ` Lars Ingebrigtsen
2012-09-04 21:03 ` Paul Eggert
2012-09-05  2:53 ` Eli Zaretskii
2012-09-05 14:20   ` Sam Steingold
2012-09-05 16:35     ` Eli Zaretskii
2012-09-05 16:50       ` Sam Steingold
2012-09-05 16:54         ` Eli Zaretskii
2012-09-05 19:19         ` Stephen J. Turnbull
2012-09-05 20:34           ` Tom Tromey
2012-09-06  0:20             ` Stephen J. Turnbull
2012-09-06  1:53               ` Tom Tromey
2012-09-06  8:34                 ` Stephen J. Turnbull
2012-09-05 18:13     ` Stefan Monnier
2012-09-05 18:28     ` Tom Tromey
2012-09-05 19:14       ` Stefan Monnier
2012-09-05 18:20   ` Tom Tromey
2012-09-05 19:00     ` Stephen J. Turnbull
2012-09-05 19:10       ` Tom Tromey
2012-09-05 19:50         ` Eli Zaretskii
2012-09-05 20:48           ` Stephen J. Turnbull
2012-09-06  5:16             ` Eli Zaretskii
2012-09-06  9:22               ` Stephen J. Turnbull
2012-09-06 10:58                 ` Eli Zaretskii
2012-09-07  1:26                   ` Stephen J. Turnbull
2012-09-05 20:25         ` Stephen J. Turnbull
2012-09-05 19:45       ` Eli Zaretskii
2012-09-05 19:46     ` Eli Zaretskii
2012-09-06  2:28       ` Stefan Monnier
2012-09-06  5:24         ` Eli Zaretskii
2012-09-06 12:32           ` Stefan Monnier
2012-09-05  3:49 ` SAKURAI Masashi
2012-09-05  4:34 ` Dmitry Antipov
2012-09-05  9:44   ` martin rudalics
2012-09-05 16:28     ` Eli Zaretskii
2012-09-06  7:19       ` martin rudalics
2012-09-06  7:56         ` Eli Zaretskii
2012-09-06 14:41           ` martin rudalics
2012-09-06 14:55             ` Eli Zaretskii
2012-09-06 16:04               ` martin rudalics
2012-09-06 17:07                 ` Stefan Monnier
2012-09-06 17:37                   ` martin rudalics
2012-09-06 18:22                     ` Eli Zaretskii
2012-09-06 19:25                       ` Eli Zaretskii
2012-09-07  9:52                       ` martin rudalics
2012-09-06 21:28                     ` Stefan Monnier
2012-09-07  9:52                       ` martin rudalics
2012-09-07 14:44                         ` Stefan Monnier
2012-09-07 16:13                           ` martin rudalics
2012-09-07 18:31                             ` Stefan Monnier
2012-09-06 20:49             ` PJ Weisberg
2012-09-07  5:52               ` Eli Zaretskii
2012-09-07 15:28                 ` PJ Weisberg
2012-09-08 14:58                   ` Nix
2012-09-08 15:21                     ` Eli Zaretskii
2012-09-08 19:45                     ` Stefan Monnier
2012-09-05 13:41 ` Stefan Monnier
2012-09-05 14:34   ` Tom Tromey

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).