diff options
| author | Dmitry Gutov | 2025-08-09 22:40:07 +0300 |
|---|---|---|
| committer | Dmitry Gutov | 2025-08-09 22:40:07 +0300 |
| commit | 07eb39f1132ceb15e80e7912445890faa8f5b78c (patch) | |
| tree | e6ab9c32a334fca746e68a9ac62728e312cfcd1c /src/thread.h | |
| parent | c4af4b39018923fdfc22b515acc1f6ba3f2b024d (diff) | |
| download | emacs-07eb39f1132ceb15e80e7912445890faa8f5b78c.tar.gz emacs-07eb39f1132ceb15e80e7912445890faa8f5b78c.zip | |
Allow thread's buffer to be killed, by default
* src/thread.c (Fmake_thread): Add new argument (bug#76969).
(thread_set_error): New function, extracted from thread-signal.
(Fthread_buffer_disposition): Add getter.
(Fthread_set_buffer_disposition): And setter.
(thread_check_current_buffer): Check the values of threads'
buffer_disposition.
(thread_all_before_buffer_killed): New function.
(init_threads): Set buffer_disposition to nil for the main thread.
(syms_of_threads): Add new symbols and define the error.
* src/thread.h (thread_state): New field buffer_disposition.
(thread_all_before_buffer_killed): Declare.
* src/buffer.c (Fkill_buffer): Call thread_check_current_buffer
one more time after all hooks and after that call
thread_all_before_buffer_killed.
* src/comp.c (ABI_VERSION): Increase the value.
* test/src/thread-tests.el (thread-buffer-disposition-t)
(thread-buffer-disposition-nil)
(thread-buffer-disposition-silently)
(thread-set-buffer-disposition)
(thread-set-buffer-disposition-main-thread): New tests.
* doc/lispref/threads.texi (Basic Thread Functions): Document
buffer-disposition in make-thread and its getter and setter.
* etc/NEWS: Add entry.
Diffstat (limited to 'src/thread.h')
| -rw-r--r-- | src/thread.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/thread.h b/src/thread.h index c496453b090..5a7f82319c9 100644 --- a/src/thread.h +++ b/src/thread.h | |||
| @@ -85,6 +85,9 @@ struct thread_state | |||
| 85 | Lisp_Object error_symbol; | 85 | Lisp_Object error_symbol; |
| 86 | Lisp_Object error_data; | 86 | Lisp_Object error_data; |
| 87 | 87 | ||
| 88 | /* Decides whether the thread's current buffer can be killed. */ | ||
| 89 | Lisp_Object buffer_disposition; | ||
| 90 | |||
| 88 | /* If we are waiting for some event, this holds the object we are | 91 | /* If we are waiting for some event, this holds the object we are |
| 89 | waiting on. */ | 92 | waiting on. */ |
| 90 | Lisp_Object event_object; | 93 | Lisp_Object event_object; |
| @@ -338,6 +341,8 @@ int thread_select (select_func *func, int max_fds, fd_set *rfds, | |||
| 338 | 341 | ||
| 339 | bool thread_check_current_buffer (struct buffer *); | 342 | bool thread_check_current_buffer (struct buffer *); |
| 340 | 343 | ||
| 344 | void thread_all_before_buffer_killed (Lisp_Object buffer); | ||
| 345 | |||
| 341 | INLINE_HEADER_END | 346 | INLINE_HEADER_END |
| 342 | 347 | ||
| 343 | #endif /* THREAD_H */ | 348 | #endif /* THREAD_H */ |