From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: Blocking calls and threads Date: Thu, 20 Apr 2023 10:23:46 +0300 Message-ID: <838ren6mpp.fsf@gnu.org> References: Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="2885"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Lynn Winebarger Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Apr 20 09:24:23 2023 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 1ppOeV-0000W1-90 for ged-emacs-devel@m.gmane-mx.org; Thu, 20 Apr 2023 09:24:23 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ppOdl-0007Mx-3v; Thu, 20 Apr 2023 03:23:37 -0400 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 1ppOdi-0007MZ-HW for emacs-devel@gnu.org; Thu, 20 Apr 2023 03:23:34 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ppOdi-0004v7-7J; Thu, 20 Apr 2023 03:23:34 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=sWoDViKN3B4dhXGZ3dRMJ2DQZnVIw+QkwX+j6RSd+VE=; b=i4iL0IIVJTJB xRknMdLZqWO9D1LBO8tQJYW5Y5xZuSVzzU2AREDAfaAu2hXgJyA8TrPsb0v/ck14KOIafxkV3Lect NSHmcKw1dEHHXYLkAaiQoNJ5z6BVt/o1mC/gk88DcSaZAj18hdbMGdXZmqkuvOtaqzU+YQoQs3Ou8 H/07B2k9fG5eKfOPQmJ+4gjQZjsO1+qR5/HOE1wGWXdSlZZ9hZgHj/b57ie6vGxgYusc68sbFj+c2 mDxeEVGpwWNqxUnKg2sKB9P1atwxE8z8rEuCsZT9iQ5kYvrJMUr0MobK+AIHzlxWfiIULXxu/zHYm PPALOYNF0rBFqb0SfMxb6w==; Original-Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ppOdh-0004Hr-Ka; Thu, 20 Apr 2023 03:23:33 -0400 In-Reply-To: (message from Lynn Winebarger on Thu, 20 Apr 2023 01:31:14 -0400) 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:305489 Archived-At: > From: Lynn Winebarger > Date: Thu, 20 Apr 2023 01:31:14 -0400 > > The thread on how to make asynchronous behavior explicit made me > curious whether making a blocking system call would cause the lisp > thread to yield to other lisp threads (release the global lock). Do > blocking system calls yield the lisp thread, or is there any way in > lisp code to call blocking functions so that the lisp thread will > yield while the system thread blocks? What do you mean by "blocking system calls", exactly? If you mean the likes of 'read' and 'write' (i.e. "blocking system calls" on the OS level), then no, a thread which makes these calls will not yield. How can it? the implementation of those calls is not in Emacs, so how can Emacs change the way these syscalls work? The "blocking system calls" which do yield are calls emitted from Lisp: accept-process-output, sit-for, read-key-sequence, etc.