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 11:03:47 -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 1476468291 5098 195.159.176.226 (14 Oct 2016 18:04:51 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 14 Oct 2016 18:04:51 +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 20:04:46 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 1bv6qU-0008NU-2d for ged-emacs-devel@m.gmane.org; Fri, 14 Oct 2016 20:04:38 +0200 Original-Received: from localhost ([::1]:48746 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bv6qS-0005Wf-If for ged-emacs-devel@m.gmane.org; Fri, 14 Oct 2016 14:04:36 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:60100) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bv6pr-0005Wa-DN for emacs-devel@gnu.org; Fri, 14 Oct 2016 14:04:00 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bv6pl-0007tU-Go for emacs-devel@gnu.org; Fri, 14 Oct 2016 14:03:58 -0400 Original-Received: from mail-pf0-x236.google.com ([2607:f8b0:400e:c00::236]:36862) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1bv6pl-0007t7-9l for emacs-devel@gnu.org; Fri, 14 Oct 2016 14:03:53 -0400 Original-Received: by mail-pf0-x236.google.com with SMTP id e6so52568586pfk.3 for ; Fri, 14 Oct 2016 11:03:52 -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=m87CeaTOBUR3l5BmSbsxinrGN69VDBD7JBoXz2iUwDgCOjeGhTFm1FdkzlEwuEbm8D jTUCk31NTybiJoa378ATEZy43q9/dkXU4dS5WoacCGRYtsztyqdEM5iXZCN/SIwXROFw yqQAUruum/ZrsV7SyXIZLbnIdSq5uDMOV0DFxwGkkUVbRhXRv01otG5Fxkjiqch2jBLP UaDLA4/beGwGyT3tanlD/cJeBK0pxkG7l8eHWOwLxsdLa9ayHMLvCru00BJMnKvgOFPd /C6BaFhNf4t81XAB0sSeYO+SokiI3Gwcf3Rnw7JbX6pBPNnK66/ujhbvQvY0PJsrDRQk IlSA== 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=lRGz2yodNGGA5QXGiPlITymii1MBZh7xe9PsTZaWxqmX9tGSWM6v+OiP5WLMWrN9Nk 6tQaz14/mIMpI6AUaV6/Yt/rnpmHIODB1Xh5HLhhap7S5t79B+xxA1xmppekewoysb63 loM1sgJfbofLDeewU9PdwAIKSNi/wSNYxQNnBnOMMYS5Q4rusG3k9IFbsZ7PLPh4klKo HLeLTDZqbSDEAyps5XqHLbxRUGqlOOEpAI8/dFB4MXnlFHlPNKZKXQXQf1u6md16zkrP SsH6PS8+s/lDkJEG5QwPDyjEG1bFrPUj9EOpV2OmemmVvnaK+7AiEcPgVQmQ2j0uaoFc A0tg== X-Gm-Message-State: AA6/9RniGQzHbQleP05xQK9bO2J/P+3aScnsPEzTozZnoaZ08maK1sE2vMC0CpXAbbxNuw== X-Received: by 10.98.18.220 with SMTP id 89mr20295572pfs.71.1476468231714; Fri, 14 Oct 2016 11:03:51 -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 l187sm29085593pfc.0.2016.10.14.11.03.50 (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 14 Oct 2016 11:03:50 -0700 (PDT) X-Google-Original-From: "John Wiegley" Original-Received: by Vulcan.local (Postfix, from userid 501) id 43ADF2FDD614; Fri, 14 Oct 2016 11:03:50 -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::236 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:208253 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