From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Philipp Stephani Newsgroups: gmane.emacs.devel Subject: Re: call-process blocks the active thread Date: Fri, 08 Sep 2017 11:27:29 +0000 Message-ID: References: <837ex9znba.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="001a1140f7b0561d7c0558abddd5" X-Trace: blaine.gmane.org 1504870239 8620 195.159.176.226 (8 Sep 2017 11:30:39 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 8 Sep 2017 11:30:39 +0000 (UTC) Cc: emacs-devel To: =?UTF-8?Q?Elias_M=C3=A5rtenson?= , Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Sep 08 13:30:24 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 1dqHU7-0000qA-H0 for ged-emacs-devel@m.gmane.org; Fri, 08 Sep 2017 13:30:07 +0200 Original-Received: from localhost ([::1]:44775 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dqHUE-00029u-IQ for ged-emacs-devel@m.gmane.org; Fri, 08 Sep 2017 07:30:14 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:52013) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dqHRv-0008QJ-RB for emacs-devel@gnu.org; Fri, 08 Sep 2017 07:27:53 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dqHRr-00023p-3n for emacs-devel@gnu.org; Fri, 08 Sep 2017 07:27:51 -0400 Original-Received: from mail-oi0-x232.google.com ([2607:f8b0:4003:c06::232]:36666) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dqHRl-0001xT-Ib; Fri, 08 Sep 2017 07:27:41 -0400 Original-Received: by mail-oi0-x232.google.com with SMTP id x190so13017014oix.3; Fri, 08 Sep 2017 04:27:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=pOOJCT7u74CTF4QjBeU5KK9VtbCEi1eze+KVInmvns0=; b=mtlm7/05Es3LfaxREziRpCVDruPH5Qltg1rIDV/66MPzHUHA+UN8YfL7RP6WND+JDF AByhj7NEBlGxiaPT4ggF/WTxke207xoeKjpFzuUtHPMEH9WsPL4XR85GIYMnLypuP1uN 6qT5j/tuP2SlgnjRuDsyevVBpGGFVnHnm0LqQbIrr7+NFDdtXBXwufthJ81FWLxwwL4F 0ba9hgtLg3rb6FmhGG5gvpMgnr4WBTO56RH98yvTfc9OIHmr2lMeTEOrj4WkBvjR47HM NjzJ+aRmU68wmhwHily3brNYVqxA7Wm8Kpr8esrWCn63uQbQZyxPUmkQ6a18Y74quHz9 wqZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=pOOJCT7u74CTF4QjBeU5KK9VtbCEi1eze+KVInmvns0=; b=l+Ff1IBbZ82KFdDOXqrog7MJqxCc+UEXyn+YGMI0Lf383+K/EUMlfCL3kVxRbUpUwb MW/yjLylKbLkAL0aH8jU7/MQf8szO7DVstne9zIbhlc5i3Sq4CIDyk8xE8mLUPSyLW9o 2ytkOwe3whf4qB31cxIR9hZnemBerk6z1mPvs4zM8QuHZapvlsOOc8WiqWpFDoTn8lPf rtOzFLJ/jwsWgBIYG+bM0NOar01lqLtvsKvH19GWbNQZvlXcLIPblwgnSHHDRqd4eC2p Fh6qaWYUWBAzOIViV0AFQ8F2LRXEXHrGyR8cdhTzONDdZSdCdVGzbENwZ/t5j0rwyReU DTHQ== X-Gm-Message-State: AHPjjUjpFzdZnWjzLM2d3Sw2mNzS3CAfaiCPdFjgd8QjxFEX00IgTV7c QeF9y9Y6ZOLrrywbebvwHgXtiyjnJw== X-Google-Smtp-Source: AOwi7QBawPW7Lf33+3Sr4YECidibfmqM5WUKYpNUjN/QQfBYXQqt2rqqfu8YG3oPKY1Jjrm/68T6UIMOWW8sRgh1jtU= X-Received: by 10.202.102.194 with SMTP id m63mr2298035oik.296.1504870059611; Fri, 08 Sep 2017 04:27:39 -0700 (PDT) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4003:c06::232 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:218014 Archived-At: --001a1140f7b0561d7c0558abddd5 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Elias M=C3=A5rtenson schrieb am Fr., 8. Sep. 2017 um 13:00 Uhr: > On 8 September 2017 at 15:01, Eli Zaretskii wrote: > >> > From: Elias M=C3=A5rtenson >> > Date: Fri, 8 Sep 2017 11:00:42 +0800 >> > >> > As it turns out, =E2=80=98call-process=E2=80=99 hangs all of Emacs whi= le the external >> program is run. >> >> No, it hangs the calling thread, and the other threads wait for the >> calling thread to yield. To avoid that, use start-process instead. >> >> This is not a bug. >> > > I'm not entirely sure why you feel that distinction is important. At the > end of the day, it's =E2=80=98start-process=E2=80=99 that doesn't yield w= hile the external > process runs. Is there a reason why it can't be changed so that it does? > Emacs threads can't run in parallel because they share global mutable state (buffers etc.) without synchronization. `call-process' is guaranteed to not affect the global state in "significant" ways, therefore it can't yield to threads that could change the global state. It's not possible to fix this. --001a1140f7b0561d7c0558abddd5 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


On 8 September 2017 at 15:01, Eli Zaretskii <eliz@gnu.org&= gt; wrote:
> From: Elias M=C3= =A5rtenson <loked= hs@gmail.com>
> Date: Fri, 8 Sep 2017 11:00:42 +0800
>
> As it turns out, =E2=80=98call-process=E2=80=99 hangs all of Emacs whi= le the external program is run.

No, it hangs the calling thread, and the other threads wait for the<= br> calling thread to yield.=C2=A0 To avoid that, use start-process instead.
This is not a bug.

I'm not entirely sure why you feel that distinction is important. A= t the end of the day, it's =E2=80=98start-process=E2=80=99 that doesn&#= 39;t yield while the external process runs. Is there a reason why it can= 9;t be changed so that it does?

Emacs threads can't run in parallel because they share global mutable = state (buffers etc.) without synchronization. `call-process' is guarant= eed to not affect the global state in "significant" ways, therefo= re it can't yield to threads that could change the global state.
<= div>It's not possible to fix this.
--001a1140f7b0561d7c0558abddd5--