mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-23 14:10:28 -08:00
Rename thread-alive-p to thread-live-p
* doc/lispref/threads.texi (Basic Thread Functions): Use thread-live-p. * etc/NEWS: 'thread-alive-p' has been renamed to 'thread-live-p'. * src/thread.c (thread_live_p): Rename from thread_alive_p. Adapt all callees. (Fthread_live_p): Rename from Fthread_alive_p. (syms_of_threads): Make thread-alive-p an alias of thread-live-p. * test/src/thread-tests.el (all): Replace `thread-alive-p' by `thread-live-p'. (threads-live): Rename from `threads-alive'.
This commit is contained in:
parent
3d09d533d1
commit
ac7936cb8f
4 changed files with 24 additions and 16 deletions
|
|
@ -97,7 +97,7 @@ Yield execution to the next runnable thread.
|
||||||
Return the name of @var{thread}, as specified to @code{make-thread}.
|
Return the name of @var{thread}, as specified to @code{make-thread}.
|
||||||
@end defun
|
@end defun
|
||||||
|
|
||||||
@defun thread-alive-p thread
|
@defun thread-live-p thread
|
||||||
Return @code{t} if @var{thread} is alive, or @code{nil} if it is not.
|
Return @code{t} if @var{thread} is alive, or @code{nil} if it is not.
|
||||||
A thread is alive as long as its function is still executing.
|
A thread is alive as long as its function is still executing.
|
||||||
@end defun
|
@end defun
|
||||||
|
|
|
||||||
5
etc/NEWS
5
etc/NEWS
|
|
@ -112,6 +112,11 @@ option 'vc-hg-symbolic-revision-styles' to the value '("{rev}")'.
|
||||||
Existing files "~/.emacs.d/shadows" and "~/.emacs.d/shadow_todo" must
|
Existing files "~/.emacs.d/shadows" and "~/.emacs.d/shadow_todo" must
|
||||||
be removed prior using the changed 'shadow-*' commands.
|
be removed prior using the changed 'shadow-*' commands.
|
||||||
|
|
||||||
|
+++
|
||||||
|
** 'thread-alive-p' has been renamed to 'thread-live-p'.
|
||||||
|
The old name is an alias of the new name. Future Emacs version will
|
||||||
|
obsolete it.
|
||||||
|
|
||||||
|
|
||||||
* Lisp Changes in Emacs 26.2
|
* Lisp Changes in Emacs 26.2
|
||||||
|
|
||||||
|
|
|
||||||
17
src/thread.c
17
src/thread.c
|
|
@ -41,7 +41,7 @@ extern volatile int interrupt_input_blocked;
|
||||||
|
|
||||||
/* m_specpdl is set when the thread is created and cleared when the
|
/* m_specpdl is set when the thread is created and cleared when the
|
||||||
thread dies. */
|
thread dies. */
|
||||||
#define thread_alive_p(STATE) ((STATE)->m_specpdl != NULL)
|
#define thread_live_p(STATE) ((STATE)->m_specpdl != NULL)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -884,7 +884,7 @@ or `thread-join' in the target thread. */)
|
||||||
return Qnil;
|
return Qnil;
|
||||||
}
|
}
|
||||||
|
|
||||||
DEFUN ("thread-alive-p", Fthread_alive_p, Sthread_alive_p, 1, 1, 0,
|
DEFUN ("thread-live-p", Fthread_live_p, Sthread_live_p, 1, 1, 0,
|
||||||
doc: /* Return t if THREAD is alive, or nil if it has exited. */)
|
doc: /* Return t if THREAD is alive, or nil if it has exited. */)
|
||||||
(Lisp_Object thread)
|
(Lisp_Object thread)
|
||||||
{
|
{
|
||||||
|
|
@ -893,7 +893,7 @@ DEFUN ("thread-alive-p", Fthread_alive_p, Sthread_alive_p, 1, 1, 0,
|
||||||
CHECK_THREAD (thread);
|
CHECK_THREAD (thread);
|
||||||
tstate = XTHREAD (thread);
|
tstate = XTHREAD (thread);
|
||||||
|
|
||||||
return thread_alive_p (tstate) ? Qt : Qnil;
|
return thread_live_p (tstate) ? Qt : Qnil;
|
||||||
}
|
}
|
||||||
|
|
||||||
DEFUN ("thread--blocker", Fthread_blocker, Sthread_blocker, 1, 1, 0,
|
DEFUN ("thread--blocker", Fthread_blocker, Sthread_blocker, 1, 1, 0,
|
||||||
|
|
@ -923,7 +923,7 @@ thread_join_callback (void *arg)
|
||||||
XSETTHREAD (thread, tstate);
|
XSETTHREAD (thread, tstate);
|
||||||
self->event_object = thread;
|
self->event_object = thread;
|
||||||
self->wait_condvar = &tstate->thread_condvar;
|
self->wait_condvar = &tstate->thread_condvar;
|
||||||
while (thread_alive_p (tstate) && NILP (self->error_symbol))
|
while (thread_live_p (tstate) && NILP (self->error_symbol))
|
||||||
sys_cond_wait (self->wait_condvar, &global_lock);
|
sys_cond_wait (self->wait_condvar, &global_lock);
|
||||||
|
|
||||||
self->wait_condvar = NULL;
|
self->wait_condvar = NULL;
|
||||||
|
|
@ -946,7 +946,7 @@ It is an error for a thread to try to join itself. */)
|
||||||
if (tstate == current_thread)
|
if (tstate == current_thread)
|
||||||
error ("Cannot join current thread");
|
error ("Cannot join current thread");
|
||||||
|
|
||||||
if (thread_alive_p (tstate))
|
if (thread_live_p (tstate))
|
||||||
flush_stack_call_func (thread_join_callback, tstate);
|
flush_stack_call_func (thread_join_callback, tstate);
|
||||||
|
|
||||||
return Qnil;
|
return Qnil;
|
||||||
|
|
@ -961,7 +961,7 @@ DEFUN ("all-threads", Fall_threads, Sall_threads, 0, 0, 0,
|
||||||
|
|
||||||
for (iter = all_threads; iter; iter = iter->next_thread)
|
for (iter = all_threads; iter; iter = iter->next_thread)
|
||||||
{
|
{
|
||||||
if (thread_alive_p (iter))
|
if (thread_live_p (iter))
|
||||||
{
|
{
|
||||||
Lisp_Object thread;
|
Lisp_Object thread;
|
||||||
|
|
||||||
|
|
@ -1051,7 +1051,7 @@ syms_of_threads (void)
|
||||||
defsubr (&Scurrent_thread);
|
defsubr (&Scurrent_thread);
|
||||||
defsubr (&Sthread_name);
|
defsubr (&Sthread_name);
|
||||||
defsubr (&Sthread_signal);
|
defsubr (&Sthread_signal);
|
||||||
defsubr (&Sthread_alive_p);
|
defsubr (&Sthread_live_p);
|
||||||
defsubr (&Sthread_join);
|
defsubr (&Sthread_join);
|
||||||
defsubr (&Sthread_blocker);
|
defsubr (&Sthread_blocker);
|
||||||
defsubr (&Sall_threads);
|
defsubr (&Sall_threads);
|
||||||
|
|
@ -1069,6 +1069,9 @@ syms_of_threads (void)
|
||||||
staticpro (&last_thread_error);
|
staticpro (&last_thread_error);
|
||||||
last_thread_error = Qnil;
|
last_thread_error = Qnil;
|
||||||
|
|
||||||
|
Fdefalias (intern_c_string ("thread-alive-p"),
|
||||||
|
intern_c_string ("thread-live-p"), Qnil);
|
||||||
|
|
||||||
Fprovide (intern_c_string ("threads"), Qnil);
|
Fprovide (intern_c_string ("threads"), Qnil);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@
|
||||||
(declare-function mutex-lock "thread.c" (mutex))
|
(declare-function mutex-lock "thread.c" (mutex))
|
||||||
(declare-function mutex-unlock "thread.c" (mutex))
|
(declare-function mutex-unlock "thread.c" (mutex))
|
||||||
(declare-function thread--blocker "thread.c" (thread))
|
(declare-function thread--blocker "thread.c" (thread))
|
||||||
(declare-function thread-alive-p "thread.c" (thread))
|
(declare-function thread-live-p "thread.c" (thread))
|
||||||
(declare-function thread-join "thread.c" (thread))
|
(declare-function thread-join "thread.c" (thread))
|
||||||
(declare-function thread-last-error "thread.c" ())
|
(declare-function thread-last-error "thread.c" ())
|
||||||
(declare-function thread-name "thread.c" (thread))
|
(declare-function thread-name "thread.c" (thread))
|
||||||
|
|
@ -60,11 +60,11 @@
|
||||||
(should
|
(should
|
||||||
(string= "hi bob" (thread-name (make-thread #'ignore "hi bob")))))
|
(string= "hi bob" (thread-name (make-thread #'ignore "hi bob")))))
|
||||||
|
|
||||||
(ert-deftest threads-alive ()
|
(ert-deftest threads-live ()
|
||||||
"Test for thread liveness."
|
"Test for thread liveness."
|
||||||
(skip-unless (featurep 'threads))
|
(skip-unless (featurep 'threads))
|
||||||
(should
|
(should
|
||||||
(thread-alive-p (make-thread #'ignore))))
|
(thread-live-p (make-thread #'ignore))))
|
||||||
|
|
||||||
(ert-deftest threads-all-threads ()
|
(ert-deftest threads-all-threads ()
|
||||||
"Simple test for all-threads."
|
"Simple test for all-threads."
|
||||||
|
|
@ -96,7 +96,7 @@
|
||||||
(let ((thread (make-thread #'threads-test-thread1)))
|
(let ((thread (make-thread #'threads-test-thread1)))
|
||||||
(thread-join thread)
|
(thread-join thread)
|
||||||
(and threads-test-global
|
(and threads-test-global
|
||||||
(not (thread-alive-p thread)))))))
|
(not (thread-live-p thread)))))))
|
||||||
|
|
||||||
(ert-deftest threads-join-self ()
|
(ert-deftest threads-join-self ()
|
||||||
"Cannot `thread-join' the current thread."
|
"Cannot `thread-join' the current thread."
|
||||||
|
|
@ -271,7 +271,7 @@
|
||||||
(let (th1 th2)
|
(let (th1 th2)
|
||||||
(setq th1 (make-thread #'threads-call-error "call-error"))
|
(setq th1 (make-thread #'threads-call-error "call-error"))
|
||||||
(should (threadp th1))
|
(should (threadp th1))
|
||||||
(while (thread-alive-p th1)
|
(while (thread-live-p th1)
|
||||||
(thread-yield))
|
(thread-yield))
|
||||||
(should (equal (thread-last-error)
|
(should (equal (thread-last-error)
|
||||||
'(error "Error is called")))
|
'(error "Error is called")))
|
||||||
|
|
@ -297,7 +297,7 @@
|
||||||
(while t (thread-yield))))))
|
(while t (thread-yield))))))
|
||||||
(thread-signal thread 'error nil)
|
(thread-signal thread 'error nil)
|
||||||
(sit-for 1)
|
(sit-for 1)
|
||||||
(should-not (thread-alive-p thread))
|
(should-not (thread-live-p thread))
|
||||||
(should (equal (thread-last-error) '(error)))))
|
(should (equal (thread-last-error) '(error)))))
|
||||||
|
|
||||||
(defvar threads-condvar nil)
|
(defvar threads-condvar nil)
|
||||||
|
|
@ -323,7 +323,7 @@
|
||||||
(setq new-thread (make-thread #'threads-test-condvar-wait))
|
(setq new-thread (make-thread #'threads-test-condvar-wait))
|
||||||
|
|
||||||
;; Make sure new-thread is alive.
|
;; Make sure new-thread is alive.
|
||||||
(should (thread-alive-p new-thread))
|
(should (thread-live-p new-thread))
|
||||||
(should (= (length (all-threads)) 2))
|
(should (= (length (all-threads)) 2))
|
||||||
;; Wait for new-thread to become blocked on the condvar.
|
;; Wait for new-thread to become blocked on the condvar.
|
||||||
(while (not (eq (thread--blocker new-thread) threads-condvar))
|
(while (not (eq (thread--blocker new-thread) threads-condvar))
|
||||||
|
|
@ -336,7 +336,7 @@
|
||||||
(sleep-for 0.1)
|
(sleep-for 0.1)
|
||||||
;; Make sure the thread is still there. This used to fail due to
|
;; Make sure the thread is still there. This used to fail due to
|
||||||
;; a bug in thread.c:condition_wait_callback.
|
;; a bug in thread.c:condition_wait_callback.
|
||||||
(should (thread-alive-p new-thread))
|
(should (thread-live-p new-thread))
|
||||||
(should (= (length (all-threads)) 2))
|
(should (= (length (all-threads)) 2))
|
||||||
(should (eq (thread--blocker new-thread) threads-condvar))
|
(should (eq (thread--blocker new-thread) threads-condvar))
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue