From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: John Wiegley Newsgroups: gmane.emacs.devel Subject: Re: Concurrency, again Date: Fri, 14 Oct 2016 09:57:09 -0700 Message-ID: References: <87wq97i78i.fsf@earlgrey.lan> <86k2dk77w6.fsf@molnjunk.nocrew.org> <9D64B8EA-DB52-413D-AE6A-264416C391F3@iotcl.com> <83int1g0s5.fsf@gnu.org> <83twckekqq.fsf@gnu.org> <83mvi9a3mh.fsf@gnu.org> <20161012165911.58437154@jabberwock.cb.piermont.com> <20161012173314.799d1dc5@jabberwock.cb.piermont.com> <8360owaj2s.fsf@gnu.org> <20161013092701.77461800@jabberwock.cb.piermont.com> <87insvt0i9.fsf@lifelogs.com> <87zim7hr06.fsf@gmx.de> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1476464473 26723 195.159.176.226 (14 Oct 2016 17:01:13 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 14 Oct 2016 17:01:13 +0000 (UTC) User-Agent: Gnus/5.130014 (Ma Gnus v0.14) Emacs/25.1.50 (darwin) Cc: emacs-devel@gnu.org To: Michael Albinus Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Oct 14 19:01:08 2016 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 1bv5qr-000599-Rt for ged-emacs-devel@m.gmane.org; Fri, 14 Oct 2016 19:00:57 +0200 Original-Received: from localhost ([::1]:48515 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bv5qq-0002cI-E9 for ged-emacs-devel@m.gmane.org; Fri, 14 Oct 2016 13:00:56 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:45811) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bv5nS-0001Hg-Jb for emacs-devel@gnu.org; Fri, 14 Oct 2016 12:57:27 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bv5nR-0002mI-6i for emacs-devel@gnu.org; Fri, 14 Oct 2016 12:57:26 -0400 Original-Received: from mail-pf0-x234.google.com ([2607:f8b0:400e:c00::234]:33318) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bv5nR-0002m8-0M for emacs-devel@gnu.org; Fri, 14 Oct 2016 12:57:25 -0400 Original-Received: by mail-pf0-x234.google.com with SMTP id 128so52585684pfz.0 for ; Fri, 14 Oct 2016 09:57:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:in-reply-to:date:message-id:references :user-agent:mail-followup-to:mime-version; bh=IG81ju56PcexmjT5GPwYC4op9zcFsscQoq+bGb64VSM=; b=q6NLcoMDT+dVBs9AMKMxz684MZACR7dZzl0HpM8TLMtEp1Ivvh6umTtS5WuElQuI+U 5EiBV2WOjKb3UNC2bzcQmWjwvnL6L4/t4Jh1s4NlIm5P9ADU4LJfj/VKOaw8koyKNHvA pCmoyxYBkwN5WTUo4wWmqQ03YRJM0nx+vmHKOhf8s0yhqs3b+Zp1nU4iqMXgUDIAtk0X OL5s/7vOCB+xb39xUoInNoxRJlFJb0wcoonag2awa5JKY/RoD0yuwTC6vZaMREucYpdo 58pP/nn8Bma9gru2OnLSZkH3wofYHFh3AzJNP0HW2Q61KQQXD+SUutpE0g+2HjT6KxEG Rfbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:in-reply-to:date:message-id :references:user-agent:mail-followup-to:mime-version; bh=IG81ju56PcexmjT5GPwYC4op9zcFsscQoq+bGb64VSM=; b=d7QZLmhVvgl5NGldOneAwahhLu+jkApCbP40oO9D/Qvz4J3a90kRbmT2OFANqkkQ4a /fmB5SsumETN8zsZ11fHuCHKOXiHvl6pjbGnVyGohdJA1MwIm2M+exXMSo4PDvKgVrQZ Ps/NaOud86leAFqIK5q6bgvu4mlx6qd2S+bsessHRzQNo/KdJytvtkGx4gFV+mJbj8Wl ZaF1fHqOEazbVdXni5KSeG58TLiO9Kb5En3wnN2pUsg//23EhL/x+f1cMz8hK2xnlsKt RB99UOHTGi/nmUA0THcQY8HSFtgm8LS+nlCiia9Wea0QqEjZpq0qCoG1lVkNSwJahnSU FORg== X-Gm-Message-State: AA6/9RkaiFUZhaZyLjoQxnnl1VOqYx3TIQbCA/ZJeFvApOugcG7gYiGEeij2nKBrBBLHBQ== X-Received: by 10.98.93.25 with SMTP id r25mr19564936pfb.136.1476464244034; Fri, 14 Oct 2016 09:57:24 -0700 (PDT) Original-Received: from Vulcan.local (76-234-69-149.lightspeed.frokca.sbcglobal.net. [76.234.69.149]) by smtp.gmail.com with ESMTPSA id a4sm28902902pax.8.2016.10.14.09.57.20 (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 14 Oct 2016 09:57:20 -0700 (PDT) X-Google-Original-From: "John Wiegley" Original-Received: by Vulcan.local (Postfix, from userid 501) id 5DCAA2F881F4; Fri, 14 Oct 2016 09:57:20 -0700 (PDT) In-Reply-To: <87zim7hr06.fsf@gmx.de> (Michael Albinus's message of "Fri, 14 Oct 2016 17:47:21 +0200") Mail-Followup-To: Michael Albinus , emacs-devel@gnu.org X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:400e:c00::234 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:208250 Archived-At: >>>>> "MA" == Michael Albinus writes: MA> The point of Tramp is not to use additional power of sleeping cores, but MA> waiting for slow connections. One could already make some of its handlers MA> asynchronously as of today, but a proper API is missing. All callers of MA> (for example) `copy-file' expect, that the function has finished once it MA> returns. We would need another `copy-file-asynchronously', which offers MA> also a handler to be called once the copying has finished. Btw, this is just what I did in dired-async, and it works well enough there. The code looks roughly like this (somewhat simplified): (async-start ;; lambda form executed in the child process `(lambda () (require 'cl-lib) (require 'dired-aux) (require 'dired-x) ,(async-inject-variables dired-async-env-variables-regexp) (condition-case err (copy-file from to ok dired-copy-preserve-time) (file-date-error (dired-log "Can't set date on %s:\n%s\n" from err))) ,(dired-async-maybe-kill-ftp)) ;; the callback (lambda (&optional _ignore) (dired-async-after-file-create total (list operation (length async-fn-list)) failures skipped))) So, you can do what you mentioned today. Maybe a better solution would be to move this support into C and support direct transmission of values into the child process over IPC, rather than streaming them as text across a file handle, as it does now. Further, I'm not sure if the concurrency branch would actually execute `copy-file` asynchronously; Emacs might still block at some point during the copy, since there's a GIL preventing threads from executing at the same time. -- John Wiegley GPG fingerprint = 4710 CF98 AF9B 327B B80F http://newartisans.com 60E1 46C4 BD1A 7AC1 4BA2