From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eric Abrahamsen Newsgroups: gmane.emacs.devel Subject: Re: make-thread with lambda form instead of function symbol Date: Sun, 16 Apr 2017 20:45:19 -0700 Message-ID: <87tw5n7l4g.fsf@ericabrahamsen.net> References: <87efws9w3c.fsf@ericabrahamsen.net> <87bmrvu9am.fsf@ericabrahamsen.net> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1492400795 31359 195.159.176.226 (17 Apr 2017 03:46:35 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 17 Apr 2017 03:46:35 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Apr 17 05:46:28 2017 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 1czxcS-0007wk-2Y for ged-emacs-devel@m.gmane.org; Mon, 17 Apr 2017 05:46:28 +0200 Original-Received: from localhost ([::1]:34676 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1czxcW-0000JZ-8x for ged-emacs-devel@m.gmane.org; Sun, 16 Apr 2017 23:46:32 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:53696) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1czxbv-0000JQ-GU for emacs-devel@gnu.org; Sun, 16 Apr 2017 23:45:56 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1czxbs-0003uN-Du for emacs-devel@gnu.org; Sun, 16 Apr 2017 23:45:55 -0400 Original-Received: from [195.159.176.226] (port=46873 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1czxbs-0003tu-7H for emacs-devel@gnu.org; Sun, 16 Apr 2017 23:45:52 -0400 Original-Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1czxbf-00071X-ER for emacs-devel@gnu.org; Mon, 17 Apr 2017 05:45:39 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 52 Original-X-Complaints-To: usenet@blaine.gmane.org Cancel-Lock: sha1:TrhGgz1Odh/0IMdDDgcUD2xuV+4= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 195.159.176.226 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:214040 Archived-At: Noam Postavsky writes: > On Sun, Apr 16, 2017 at 9:12 PM, Eric Abrahamsen > wrote: >> >> (defun nnir-run-query (specs) >> (let* ((results []) >> (threads >> (mapcar >> (lambda (x) >> (let* ((server (car x)) >> (search-engine (nnir-server-to-search-engine server))) >> (make-thread >> (lambda () >> (setq results >> (vconcat >> (nnir-run-search >> search-engine >> server >> (cdr (assq 'nnir-query-spec specs)) >> (cadr x)) >> results)))))) >> (cdr (assq 'nnir-group-spec specs))))) >> (mapc #'thread-join threads) >> results)) >> >> I'm testing with a single IMAP server query (ie, only one thread is >> being created). The nnir-run-search function for the IMAP backend ends >> up calling nnimap-send-command--> nnimap-wait-for-response--> >> nnheader-accept-process-output--> accept-process-output, so I'm >> expecting that's where the thread yields. >> >> I'm attaching the traceback here. Dunno if it's something I've done >> wrong... > >> #4 0x000000000069f953 in Faccept_process_output (process=..., seconds=..., millisec=..., just_this_one=...) at process.c:4566 > > Is line process.c:4566 this one? > > error ("Attempt to accept output from process %s locked to thread %s", > SDATA (proc->name), SDATA (XTHREAD (proc->thread)->name)); > > I guess that indicates you might be doing something wrong (though > obviously Emacs shouldn't be crashing) So perhaps an existing process can't be "moved" to another thread? Tomorrow I'll set up a notmuch-indexed server and try that -- in that case the process should be invoked and concluded within a single make-thread call, so maybe it won't raise this error. But the segfault here seems to be coming from a borked attempt to represent either the process or the thread as a string....