From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: list-threads Date: Mon, 30 Jul 2018 17:59:26 +0300 Message-ID: <83pnz4py5t.fsf@gnu.org> References: <87tvoiq208.fsf@runbox.com> NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1532962693 18068 195.159.176.226 (30 Jul 2018 14:58:13 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 30 Jul 2018 14:58:13 +0000 (UTC) Cc: emacs-devel@gnu.org To: Gemini Lasswell Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Jul 30 16:58:08 2018 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fk9ce-0004ZF-LR for ged-emacs-devel@m.gmane.org; Mon, 30 Jul 2018 16:58:08 +0200 Original-Received: from localhost ([::1]:53074 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fk9el-0006fj-9J for ged-emacs-devel@m.gmane.org; Mon, 30 Jul 2018 11:00:19 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:41158) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fk9ds-0006e4-Op for emacs-devel@gnu.org; Mon, 30 Jul 2018 10:59:25 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fk9do-0003np-O0 for emacs-devel@gnu.org; Mon, 30 Jul 2018 10:59:24 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:58604) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fk9do-0003nl-Io; Mon, 30 Jul 2018 10:59:20 -0400 Original-Received: from [176.228.60.248] (port=3861 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1fk9dn-0003Ep-Vv; Mon, 30 Jul 2018 10:59:20 -0400 In-reply-to: <87tvoiq208.fsf@runbox.com> (message from Gemini Lasswell on Sat, 28 Jul 2018 18:11:51 -0700) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:227996 Archived-At: > From: Gemini Lasswell > 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.