all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Gemini Lasswell <gazally@runbox.com>
Cc: emacs-devel@gnu.org
Subject: Re: list-threads
Date: Mon, 30 Jul 2018 17:59:26 +0300	[thread overview]
Message-ID: <83pnz4py5t.fsf@gnu.org> (raw)
In-Reply-To: <87tvoiq208.fsf@runbox.com> (message from Gemini Lasswell on Sat,  28 Jul 2018 18:11:51 -0700)

> From: Gemini Lasswell <gazally@runbox.com>
> Date: Sat, 28 Jul 2018 18:11:51 -0700
> 
> I've just pushed a commit to scratch/list-threads which might be useful
> to those of you working with threads in Emacs. There is a new command
> 'list-threads' which produces a tabulated list buffer showing the
> currently live threads with their status, sets a timer to keep it
> refreshed, and provides two commands, 's q' and 's e' for sending quit
> and error signals, respectively, to the thread at point.

Thanks, please see some comments below.

> Next up I'm going to see if my rusty C skills are up to adding a
> 'thread' argument to the backtrace primitives, to make it possible to
> generate a backtrace for any thread from the thread list buffer.

You mean, take a backtrace while the target thread is waiting to run?

Here are the comments to your branch:

> +++ b/lisp/emacs-lisp/thread-list.el

I'm not sure this file should be called thread-list.el, nor that it
should be in emacs-lisp/.  I think it should be under lisp/, and
should be the home for all thread-related features implemented in
Lisp.

> +(defun thread-list--timer-func (buf)
> +  "Revert BUF and set a timer to do it again."

Suggest to rename the argument BUFFER, then the doc string will be
more clear, IMO.

> +(defun thread-list--get-entries ()
> +  "Return tabulated list entries for the threads currently active."

"for the currently active threads".

Actually, I'd use "live", not "active", because they really aren't (or
else the definition of "active" in this case could confuse users).

> +Return a list of two strings, the first describing THREAD's
> +status and the second describing what it is blocked on if it is
> +blocked."

I'd rephrase:

  Return a list of two strings: one describing THREAD's status,
  the other describing THREAD's blocker, if any.

> +(defun thread-list--send-signal (sgnl)
> +  "Send the signal SGNL to the thread at point.

I'd use

  Send the specified SIGNAL to the thread at point.

> +Confirm with the user first."

"Ask for user confirmation before signaling the thread."

> +  (let ((thread (tabulated-list-get-id)))
> +    (when (and (threadp thread) (thread-alive-p thread))
> +      (when (y-or-n-p (format "Send %s signal to %s? " sgnl thread))
> +        (when (and (threadp thread) (thread-alive-p thread))
> +          (thread-signal thread sgnl nil))))))

This silently does nothing if the thread is no longer alive.  I'd
suggest some echo-area message to that effect.

Finally, this needs NEWS entry and a short description for the user
manual.



  parent reply	other threads:[~2018-07-30 14:59 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-29  1:11 list-threads Gemini Lasswell
2018-07-29  7:56 ` list-threads Michael Albinus
2018-07-29  8:37   ` list-threads Michael Albinus
2018-07-29 14:31   ` list-threads Gemini Lasswell
2018-07-29 17:31     ` list-threads Eli Zaretskii
2018-07-30 13:27       ` list-threads Gemini Lasswell
2018-07-30 17:21     ` list-threads Stefan Monnier
2018-07-30 14:59 ` Eli Zaretskii [this message]
2018-08-01 16:03   ` list-threads Gemini Lasswell
2018-08-01 16:37     ` list-threads Eli Zaretskii
2018-08-01 20:04       ` list-threads Gemini Lasswell
2018-08-02 13:53         ` list-threads Eli Zaretskii
2018-08-02 14:51           ` list-threads Gemini Lasswell
2018-08-27 17:38 ` list-threads Gemini Lasswell
2018-08-27 18:48   ` list-threads Eli Zaretskii
2018-09-09 15:44     ` list-threads Gemini Lasswell
2018-09-09 16:01       ` list-threads Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83pnz4py5t.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=gazally@runbox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.