From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Akira Kyle Newsgroups: gmane.emacs.devel Subject: Re: "Asynchronous Requests from Emacs Dynamic Modules" Date: Sun, 01 Nov 2020 13:18:40 -0700 Message-ID: <867dr4omov.fsf@akirakyle.com> References: <86imarfldb.fsf@akirakyle.com> Mime-Version: 1.0 Content-Type: text/plain; format=flowed Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="22885"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: mu4e 1.4.13; emacs 28.0.50 Cc: Philipp Stephani , Emacs developers To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun Nov 01 21:19:27 2020 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kZJp1-0005rL-Rd for ged-emacs-devel@m.gmane-mx.org; Sun, 01 Nov 2020 21:19:27 +0100 Original-Received: from localhost ([::1]:39714 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kZJp0-0005jB-Uu for ged-emacs-devel@m.gmane-mx.org; Sun, 01 Nov 2020 15:19:26 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:52858) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kZJoL-00059c-6j for emacs-devel@gnu.org; Sun, 01 Nov 2020 15:18:45 -0500 Original-Received: from mail-ot1-f41.google.com ([209.85.210.41]:41980) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kZJoI-0000Ip-AP for emacs-devel@gnu.org; Sun, 01 Nov 2020 15:18:44 -0500 Original-Received: by mail-ot1-f41.google.com with SMTP id n15so10700616otl.8 for ; Sun, 01 Nov 2020 12:18:41 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:references:user-agent:from:to:cc:subject :in-reply-to:date:message-id:mime-version; bh=VA7g55k1TwPX1dnu/wQYcE1jJNHbfI9RgS9l6BSn9FE=; b=C6kXykHZqma9ty1w3JQByd4+fQAVL56Os5/Pn8C3u/2MVjik7fqozEA3IJ/zR+2PrR Bem7a6c8cygH7IFNhkXuTedMPQni2xVx8Cq+4UQt6HUuOd/Iz1+3W8lZ8E1/tw2+Y+Zi tW/GUPGVc8Ui96/L4IBQj/BSM90weVUkTzy8ArwL2jkOdKO2Kor/LWkQb83Mqwu545hJ EyPOlT7YeNXtrxf1Hz1zA1OF2zlpXF3SWEMbmqPEElQOZNbfw3OapvvCL3QpPCh2+qO1 KbkD3MWAKpwp3g5GzTaF0CIDeln1p/yMO1ZxUspRX7omFw0ghRv8ZC4uJYCXa2zh/fkH LzVw== X-Gm-Message-State: AOAM530REJIME6Cx5gEb+e99t0CWZTECbscv2w0mknFdFhpLza2h4l2d GoUczbiGur6DuV46iFCWWh9swmvzo5fyLg== X-Google-Smtp-Source: ABdhPJw2EAuqXb8py4Ut+Ateg2ZtMiZdQ8eF0tZ+mkhvgGa7+rSLRp9KoaaLtT4lY2lzKPv1hgnYLg== X-Received: by 2002:a9d:23a6:: with SMTP id t35mr9118968otb.210.1604261921237; Sun, 01 Nov 2020 12:18:41 -0800 (PST) Original-Received: from lore (c-67-162-131-131.hsd1.co.comcast.net. [67.162.131.131]) by smtp.gmail.com with ESMTPSA id b7sm2923335oic.36.2020.11.01.12.18.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 01 Nov 2020 12:18:40 -0800 (PST) In-reply-to: Received-SPF: pass client-ip=209.85.210.41; envelope-from=aikokyle@gmail.com; helo=mail-ot1-f41.google.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/11/01 15:18:41 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -13 X-Spam_score: -1.4 X-Spam_bar: - X-Spam_report: (-1.4 / 5.0 requ) BAYES_00=-1.9, FREEMAIL_FORGED_FROMDOMAIN=0.25, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 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-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:258608 Archived-At: On Sat, Oct 31, 2020 at 06:49 AM, Stefan Monnier wrote: >> With Emacs 28, you can get a file descriptor to a pipe process >> and >> send arbitrary data there (from arbitrary threads). > > Cool, so that takes care of it. > >> You'd still need some small protocol (e.g. JSON) to >> encode/decode >> requests, but with that you can send arbitrary requests >> back asynchronously. > > I don't think you need a complex protocol: just stash somewhere > (inside > the module data structures) the data you need for the async > request, > then send a dummy byte to the pipe. On the Lisp side, just > install > a process-filter which calls back the module to "run any pending > async > requests". Thanks Philipp for pointing this out! I'm glad this was already thought of and added so the SIGUSR1 hack isn't necessary going forward. For future reference, the module function is `open_channel`.