From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Jim Porter Newsgroups: gmane.emacs.devel Subject: Re: [RFC] Adding threads to Eshell Date: Fri, 16 Dec 2022 12:25:57 -0800 Message-ID: <470f5b87-85b7-4132-48b7-0b36ed821522@gmail.com> References: <7f4e3357-2c6a-a0d2-cab5-fb641b52877a@gmail.com> <83mt7ni0ub.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="21005"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Dec 16 21:26:24 2022 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 1p6HHi-0005Gx-Oc for ged-emacs-devel@m.gmane-mx.org; Fri, 16 Dec 2022 21:26:22 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p6HHQ-0004AX-SY; Fri, 16 Dec 2022 15:26:04 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p6HHO-0004AE-T7 for emacs-devel@gnu.org; Fri, 16 Dec 2022 15:26:02 -0500 Original-Received: from mail-pl1-x636.google.com ([2607:f8b0:4864:20::636]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p6HHN-0007s8-6d; Fri, 16 Dec 2022 15:26:02 -0500 Original-Received: by mail-pl1-x636.google.com with SMTP id g10so3382268plo.11; Fri, 16 Dec 2022 12:26:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:mime-version:date:message-id:from:to:cc :subject:date:message-id:reply-to; bh=OvefrygSsuoIpZ6RH+rVJxhCjXhGoGhSwiu0YqLtaCw=; b=fEYwi7aqImrXJIXebYiuJdL37SCwdL5D+oC7OtfZkOhejjojRat1eG0rU4yBxG+EgM c+PdbttU3CJg3T8qARSHbbWsHLlJr0FqiV4a7TCbJkARkgdqbMJjkCYF6nipIB6YrMel FOrFfcFWGNdksrnF205PgkWCibeEmf8g9Zx2ukL0gKNjDHizC+EYSxXJoiIEOyvBBxKx nVRs517FWbVEr7ugh7u2inZesrWtVyczD9pzajMt5WmD6/H94P4A5xAYo9CUt2ol1Sxh wVubrva3F4AOL8v+3+66naTiNoh4/6F88rlMrNiwEK79FJxqBznxZeHfsWQ5k4fb6fWg 7ClA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=OvefrygSsuoIpZ6RH+rVJxhCjXhGoGhSwiu0YqLtaCw=; b=3YSBW/bdQ6ugG4UcY6/IHc/+3NMKI91kLVZmbmzAXthomTjmX2V75sS8KT8AA419Z9 oJ7CSgB4qLYhlEtV5GRbKULvVBJ29+B0I4NHVM2h4n0W+oXY8NFYvAeGWDh5/t1rN4Ye WIe1RNRwKwdELCA0+b3Nf+WJIkmOTvBIEdJT9XZPE5hXjG+VJm2D1EAecUZ2hFfXBmKT gYy5o/lAXm4CP6GZZbDmPqMEHhZ+IpF/MAE861cvkDc2DwYhaWZoxwo5XOHXbXl0F8CM +mjJ5kOYmWq860qvhTC714Om0XbATr0ypjPGgR3MZqbTnXdvIcZfQa9UDJplhCiiiP6p U2Mw== X-Gm-Message-State: ANoB5pnXKpMiJWCWuiYL+yVrRgw+a5ilTTtC5ziz/Qnk9W07s/nbsVqC bf2a1kqai9evP8m8bf+yfdOUy0O5C7o= X-Google-Smtp-Source: AA0mqf7C3N6G6uDazLu8EgepFEclxNLW9Vf43PGGmclF8xC0tJjogBN4Ed4F6CT2hoND64lyI0jgow== X-Received: by 2002:a05:6a20:6918:b0:9d:efc0:62 with SMTP id q24-20020a056a20691800b0009defc00062mr56915491pzj.10.1671222359386; Fri, 16 Dec 2022 12:25:59 -0800 (PST) Original-Received: from [192.168.1.2] (cpe-76-168-148-233.socal.res.rr.com. [76.168.148.233]) by smtp.googlemail.com with ESMTPSA id r7-20020a63b107000000b00478bd458bdfsm1858920pgf.88.2022.12.16.12.25.58 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 16 Dec 2022 12:25:58 -0800 (PST) Content-Language: en-US In-Reply-To: <83mt7ni0ub.fsf@gnu.org> Received-SPF: pass client-ip=2607:f8b0:4864:20::636; envelope-from=jporterbugs@gmail.com; helo=mail-pl1-x636.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 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-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:301526 Archived-At: On 12/16/2022 11:51 AM, Eli Zaretskii wrote: >> Date: Thu, 15 Dec 2022 18:37:09 -0800 >> From: Jim Porter >> >> However, before I go too far, I wanted to check with other, more >> knowledgeable people: are Emacs threads available on all platforms? > > Yes. The only known exception is MSDOS. Ok, so it looks like MSDOS is also the only platform that lacks support for async subprocesses. In that case, I think it would be ok to require threads for Eshell if you want to execute commands asynchronously. >> It looks like it requires the pthreads library > > pthreads are required only on Posix platforms; on Windows we use > Windows-specific APIs instead. See systhread.c. Ah ha. I had somehow gotten it into my head that Emacs used pthread wrappers on Win32. > No, they are real threads. You can see them with any OS-level tool > that can examine threads. We just let only a single one of these > threads to run at any given time (well, with the exception of very > short time windows). Oh, ok. I don't think that will make anything harder to implement though, so no worries there. >> I might be able to avoid this issue, but it would be nice to be able >> to let-bind some defvars and then pass those bindings to an Eshell >> command to do its thing. > > If that is what you want, you will have to pass those bindings as > arguments to the thread function. Like I said in my message to Stefan, I'm not totally sure if this is the right way to go, but I want to experiment with it a bit more. It doesn't look too hard to pass those bindings in once I have them, but I don't know of a good way to get the list of all local bindings of dynamic variables in the first place.