GNU bug report logs - #70032
30.0.50; thread-yield inconsistency with macOS GUI and other platforms

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: Daniel Pettersson <daniel@HIDDEN>; dated Wed, 27 Mar 2024 15:45:02 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at 70032 <at> debbugs.gnu.org:


Received: (at 70032) by debbugs.gnu.org; 30 Oct 2024 04:51:59 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Oct 30 00:51:59 2024
Received: from localhost ([127.0.0.1]:32959 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1t60gZ-0000re-AA
	for submit <at> debbugs.gnu.org; Wed, 30 Oct 2024 00:51:59 -0400
Received: from mail-wm1-f48.google.com ([209.85.128.48]:47507)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <gerd.moellmann@HIDDEN>) id 1t60gX-0000rU-LC
 for 70032 <at> debbugs.gnu.org; Wed, 30 Oct 2024 00:51:58 -0400
Received: by mail-wm1-f48.google.com with SMTP id
 5b1f17b1804b1-431481433bdso59754145e9.3
 for <70032 <at> debbugs.gnu.org>; Tue, 29 Oct 2024 21:51:57 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1730263852; x=1730868652; darn=debbugs.gnu.org;
 h=mime-version:user-agent:message-id:date:references:in-reply-to
 :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to;
 bh=uVuXJNkoEyGRmi3p6zIhs7hQA7J4ZiLBWA2eWORVs08=;
 b=eZvrs4rfWQ0SBqOsscSYQjVPmrnyFkuwUnejEjQ7i1NAJ+AWrOQvbQg50B8CP9DqE9
 BP3P9T19YxzE1qebYz3AvFUfkctK/z1ncwC2kGCpGOyy49YJvi7pkQD+T+modZZqf8Ah
 T/04QsARtRZKm5iQvgDf9VzBPxo16vwEyehgWzDYTvEPQabzVuOqBCSVNCQmUjAQ/95s
 oozCOq352vJ5KlApZZ9vWw8RtL79/Dgtta+LZvJc24aNPEu8su4X6yKLaRXedu3pQ0i2
 FCUx/1puM6TFEScvLZJOVq2jJmUHaD1c6+2dlNLM6IQLd9YW3LpuTGYV9FDPraPLo8Cl
 xrNg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1730263852; x=1730868652;
 h=mime-version:user-agent:message-id:date:references:in-reply-to
 :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date
 :message-id:reply-to;
 bh=uVuXJNkoEyGRmi3p6zIhs7hQA7J4ZiLBWA2eWORVs08=;
 b=f68q7XAVttYNkrHSs7Or1qbDfj7xejwEIcNLYQOUSKRdgKyNlwGuQg0AWqzq/UQfaq
 PKhm4Ey3Bt+PShbXN/3AEu2amrMu53ej2QOgU6AbF0M+XCBZj+isQxE5VAG2jW8xuIUX
 j/K8Hb3uLhHGJwR3zNk0i4Teeh3SqA5+vxUgK6qVMgliB/BydUWdRRDFE6OV3U0vvVa2
 NY0emB6+KSl2M+IhvbeX1+GfOcFFYCpyaqCGFWN/a7gqB+OboniuVftZuwaAzCE4szpG
 V8PHKsEl8u2Fazms5Vkw0xnwTUVDriL4NLFUVLeealQEOTUfeqcUamRLjzQwcYCAK2mm
 u89g==
X-Gm-Message-State: AOJu0Yy2QxFSvL++SUrWOWGbR7IdSvXeO1OhYVF7TVsdb6s9+FmTFu7V
 7OYVlniydoQc5YmslA37sx0WCEaXQR9Mnuo+uzgJiTtcdouKS0Ag
X-Google-Smtp-Source: AGHT+IEH/Trzt0QynYjS6SmSJ7PHEl97ztzwGIVyYil58Lxu8cN/CGfKrhc2/TT5+Xx3h6toCFmihQ==
X-Received: by 2002:a05:600c:1d89:b0:431:53db:3d29 with SMTP id
 5b1f17b1804b1-4319acb1026mr95786825e9.18.1730263850893; 
 Tue, 29 Oct 2024 21:50:50 -0700 (PDT)
Received: from pro2 (p4fe3a430.dip0.t-ipconnect.de. [79.227.164.48])
 by smtp.gmail.com with ESMTPSA id
 5b1f17b1804b1-431bd97d5e1sm8989505e9.27.2024.10.29.21.50.49
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Tue, 29 Oct 2024 21:50:50 -0700 (PDT)
From: =?utf-8?Q?Gerd_M=C3=B6llmann?= <gerd.moellmann@HIDDEN>
To: Daniel Pettersson <daniel@HIDDEN>
Subject: Re: 30.0.50; thread-yield inconsistency with macOS GUI and other
 platforms
In-Reply-To: <m2ttcu657f.fsf@HIDDEN> (Daniel Pettersson's message of
 "Tue, 29 Oct 2024 21:10:12 +0100")
References: <m2ttcu657f.fsf@HIDDEN>
Date: Wed, 30 Oct 2024 05:50:48 +0100
Message-ID: <m2plnixkgn.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 70032
Cc: eliz@HIDDEN, 70032 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Daniel Pettersson <daniel@HIDDEN> writes:

> Now that I am already being a nuisance, I might as well try to resurrect
> this bug as well.  I have tried to create a patch for this issue, but
> failed.  I do not understand the internals of emacs threads well enough,
> I am happy to try to give it a go but I would require some pointers to
> get me started.

In bug#72496 I wrote something that I think might be helpful to
underwtand how this works in NS. I nowadays build Emacs --without-ns.

  In GNU Emacs 31.0.50 (build 1, aarch64-apple-darwin23.6.0, NS
   appkit-2487.70 Version 14.6 (Build 23G80)) of 2024-08-05 built on
   pro2.fritz.box
  Repository revision: c7d9cd722e5a7042a52c92f8497f903bfe9870b8

  This is one of the problems on macOS that I'm experiencing quite
  often. I have no idea what is causing this, and I haven't found a way
  to make it reproducible. I guess I should file a bug report anyway.

  Let me first try to describe briefly how NS GUI event handling works
  in Emacs.

  The whole story starts with get_input_pending which calls gobble_input
  which calls a terminal's read_socket_hook, which is ns_read_socket in
  macOS. ns_read_socket calls [NSApplication run] to process macOS GUI
  events.

  The problem starts with [NSApplication run] being an endless loop that
  gets the next event, and dispatches it by calling the application's
  sendEvent method. The only way to make the run loop terminate is by
  calling [NSApplication stop]. This sets a flag that [NSApplicatoin
  run] is supposed to check and then return, so that we eventually
  return to ns_read_socket.

  We call [NSApplicaton stop] in our [EmacsApp sendEvent] method. To get
  there, we post special application-defined events to the application
  which [NSApplication run] processes and dispatches via sendEvent which
  calls stop and makes [NSApplication run] return to its caller. Note
  that stop only sets a flag, so we need to process another event to
  make run terminate. That's at least my understanding.

  We are posting these events all over the place, not only before
  ns_read_socket calls [NSApplication run]. And, to complicate matters,
  whether or not ns_send_appdefined actually posts an event depends on a
  global boolean variable. IOW, it's impenetrable.

  (I'm also leaving out the generation of input_events for Emacs here,
  which is another can of worms.)

  Problem is that this not always works. More specifically, this code in
  ns_read_socket_1

            /* Run and wait for events.  We must always send one NX_APPDEFINED event
               to ourself, otherwise [NXApp run] will never exit.  */
            send_appdefined = YES;
            ns_send_appdefined (-1);

            [NSApp run];

  gets stuck in the GUI event loop, and the last line never returns. The
  effect being that Emacs freezes without a beach ball of death. It
  processes Cocoa events but Emacs never sees any input_events.






Information forwarded to bug-gnu-emacs@HIDDEN:
bug#70032; Package emacs. Full text available.

Message received at 70032 <at> debbugs.gnu.org:


Received: (at 70032) by debbugs.gnu.org; 29 Oct 2024 20:10:17 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Oct 29 16:10:17 2024
Received: from localhost ([127.0.0.1]:58522 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1t5sXh-0000UO-3O
	for submit <at> debbugs.gnu.org; Tue, 29 Oct 2024 16:10:17 -0400
Received: from mail-lf1-f45.google.com ([209.85.167.45]:57414)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <daniel.dpettersson.net@HIDDEN>)
 id 1t5sXe-0000Rh-HS
 for 70032 <at> debbugs.gnu.org; Tue, 29 Oct 2024 16:10:15 -0400
Received: by mail-lf1-f45.google.com with SMTP id
 2adb3069b0e04-539f1292a9bso6992071e87.2
 for <70032 <at> debbugs.gnu.org>; Tue, 29 Oct 2024 13:10:14 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1730232613; x=1730837413;
 h=mime-version:user-agent:message-id:date:subject:cc:to:from
 :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
 bh=1VzhoahfaqLS3fofc0sv9aDOBgNFmwF/oIJM21IjI74=;
 b=eIdqq88VO7pFWuMaFO5FzjfcMvA3bWEC5XHzoIkyUbAq9gCfg7beMtvtSltoeIx50q
 KENexN0lX4GGBpfLKHZm+JsxwATMz5x5UNmz+rZ1hWwox5XEuMeB7l8jz2UPPf8CHwh3
 szOVXGEJyMsucx4iCpR8CiwV4/PwDV7WWxF4Y85oz96e2xH1iO6TAgWsOIbRDGH/QKLa
 cj5XDkShBgjiwEXdfiWlmAurxYaBUmvnLkaow6rGPShdtwJrItab9XL4aGdN2gxSOauW
 DH9XanIq1MQgvFXaoZdx5XMzycAjNpt7mz/Flf0dwgt4CeXBYTqekEgiyWLNhu5uzSo7
 Bq6Q==
X-Gm-Message-State: AOJu0Yyjr8HFDx1BjMTXpUzvt+8pvvVA2RVlwfeKcSH1NhFaqkDCHTnl
 gS+0JEuFn1b7l+fU1UGuyuZjHsqsZxW6mkH/y+EAd7TboA/OeDPC
X-Google-Smtp-Source: AGHT+IFzp9hXHrDRqqrjebsRSd7gZ/9DpydJQ0yMeFWnrSzubfdnlxejyFVF0vj5CNoVyoQZJJg9KA==
X-Received: by 2002:a05:6512:1385:b0:539:e80c:23f with SMTP id
 2adb3069b0e04-53b348c8d59mr5618326e87.14.1730232613147; 
 Tue, 29 Oct 2024 13:10:13 -0700 (PDT)
Received: from Daniels-Air (c-85-228-201-151.bbcust.telenor.se.
 [85.228.201.151]) by smtp.gmail.com with ESMTPSA id
 2adb3069b0e04-53bb81a5c68sm42710e87.97.2024.10.29.13.10.12
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Tue, 29 Oct 2024 13:10:12 -0700 (PDT)
From: Daniel Pettersson <daniel@HIDDEN>
To: 70032 <at> debbugs.gnu.org
Subject: Re: 30.0.50; thread-yield inconsistency with macOS GUI and other
 platforms
Date: Tue, 29 Oct 2024 21:10:12 +0100
Message-ID: <m2ttcu657f.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.3 (/)
X-Debbugs-Envelope-To: 70032
Cc: gerd.moellmann@HIDDEN, eliz@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.7 (/)


Now that I am already being a nuisance, I might as well try to resurrect
this bug as well.  I have tried to create a patch for this issue, but
failed.  I do not understand the internals of emacs threads well enough,
I am happy to try to give it a go but I would require some pointers to
get me started.






Information forwarded to bug-gnu-emacs@HIDDEN:
bug#70032; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 27 Mar 2024 15:44:20 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Mar 27 11:44:20 2024
Received: from localhost ([127.0.0.1]:38203 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1rpVRs-0003zD-8S
	for submit <at> debbugs.gnu.org; Wed, 27 Mar 2024 11:44:20 -0400
Received: from lists.gnu.org ([2001:470:142::17]:57104)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <daniel.dpettersson.net@HIDDEN>)
 id 1rpVRo-0003yM-AM
 for submit <at> debbugs.gnu.org; Wed, 27 Mar 2024 11:44:19 -0400
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 <daniel.dpettersson.net@HIDDEN>)
 id 1rpVRh-0006OR-NE
 for bug-gnu-emacs@HIDDEN; Wed, 27 Mar 2024 11:44:09 -0400
Received: from mail-lf1-f43.google.com ([209.85.167.43])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <daniel.dpettersson.net@HIDDEN>)
 id 1rpVRf-0001Yd-UL
 for bug-gnu-emacs@HIDDEN; Wed, 27 Mar 2024 11:44:09 -0400
Received: by mail-lf1-f43.google.com with SMTP id
 2adb3069b0e04-512e4f4e463so7767453e87.1
 for <bug-gnu-emacs@HIDDEN>; Wed, 27 Mar 2024 08:44:06 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1711554245; x=1712159045;
 h=mime-version:message-id:date:subject:to:from:x-gm-message-state
 :from:to:cc:subject:date:message-id:reply-to;
 bh=Qf1eGKcDnnvV+sZRrzFTfrKHx0m28fSXR67LR3kEw7g=;
 b=X/1oPnrKrtV/EdMZRDW5PG7+PVdy1vz468BoScEcEmMFROkS+Km3xgGOAsQDdSJHls
 FcngOhmB1fnJmk+61NsM15CFY0U4iHHcJwG4pYCOITtbbcNUwL2/EFkBCpROkAizIoo8
 ACsBQCHwip4jqspm50KLZcqDNV1vGlWo4ddq2EYzsdn5/LuS+lult76KMwmBH602RI1x
 l5TB1cCTS4sEcZRSPa7SrvZE5r3vt7itKrOUn1r3Pf2HchuMW2uuZwk46mjN/IlAJVzL
 OLGWyzrcruwU9fXFk5bNHFML1p4dC0ANLTeh85zJ0WbfYtf2K7WLgo+r/F8zOTezqXS9
 ldHg==
X-Gm-Message-State: AOJu0Yx9uzg1PkVr4Be/Er5ld+XEjDK/PR5OoNEubsqqAlOu/oP2k5fn
 u6AoBdzAzD9kQPRC50Hp8+kTYnIDdDfmMxwHnKZauR3W4P5r7ocU6xjIxUDM
X-Google-Smtp-Source: AGHT+IGPb1LEpDsYQFs+ILW/Mkm6ye/ihKZMr0HShdgqI2Tsk4bcDJWKiZa+1z3/fVIF8TyN61buDQ==
X-Received: by 2002:ac2:58ed:0:b0:515:8c3e:5665 with SMTP id
 v13-20020ac258ed000000b005158c3e5665mr3785272lfo.27.1711554244483; 
 Wed, 27 Mar 2024 08:44:04 -0700 (PDT)
Received: from Daniels-Air (c-72cde455.027-357-6d6c6d4.bbcust.telenor.se.
 [85.228.205.114]) by smtp.gmail.com with ESMTPSA id
 n27-20020a056512311b00b00515a7da64c8sm1506992lfb.133.2024.03.27.08.44.03
 for <bug-gnu-emacs@HIDDEN>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Wed, 27 Mar 2024 08:44:03 -0700 (PDT)
From: Daniel Pettersson <daniel@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: 30.0.50; thread-yield inconsistency with macOS GUI and other platforms
X-Debbugs-Cc: 
Date: Wed, 27 Mar 2024 16:44:02 +0100
Message-ID: <m2zfuj1xz1.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
Received-SPF: pass client-ip=209.85.167.43;
 envelope-from=daniel.dpettersson.net@HIDDEN; helo=mail-lf1-f43.google.com
X-Spam_score_int: -15
X-Spam_score: -1.6
X-Spam_bar: -
X-Spam_report: (-1.6 / 5.0 requ) BAYES_00=-1.9,
 FREEMAIL_FORGED_FROMDOMAIN=0.001, FREEMAIL_FROM=0.001,
 HEADER_FROM_DIFFERENT_DOMAINS=0.25, RCVD_IN_DNSWL_NONE=-0.0001,
 RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001 autolearn=no autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 1.2 (+)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 the administrator of that system for details.
 Content preview: (make-thread (lambda () (benchmark-progn (dotimes (_ 100000)
 (thread-yield)))) "benchmark-thread") The thread will finish in less then
 one second on macOS '-nw' and Linux (GUI and '-nw') (have not tested on
 Windows).
 Content analysis details:   (1.2 points, 10.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 0.0 FREEMAIL_FROM          Sender email is commonly abused enduser mail
 provider (daniel.dpettersson.net[at]gmail.com)
 1.0 SPF_SOFTFAIL           SPF: sender does not match SPF record (softfail)
 -0.0 SPF_HELO_PASS          SPF: HELO matches SPF record
 0.2 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level
 mail domains are different
 0.0 FREEMAIL_FORGED_FROMDOMAIN 2nd level domains in From and
 EnvelopeFrom freemail headers are different
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.2 (/)


(make-thread (lambda ()
               (benchmark-progn
                 (dotimes (_ 100000)
                   (thread-yield))))
                   "benchmark-thread")

The thread will finish in less then one second on macOS '-nw' and Linux
(GUI and '-nw') (have not tested on Windows).

On macOS GUI "benchmark-thread" will almost certainly never finish.

The only way that I know to drive the thread forward is to generate
input events, so you need to generate at 100000 input events for it to
finish. With macOS GUI the Main thread does only seam to yield back to
the other thread after an mouse/keyboard event.

* src/nsterm.m: ns_select_1

  /* emacs -nw doesn't have an NSApp, so we're done.  */
  if (NSApp == nil)
    return thread_select (pselect, nfds, readfds, writefds, exceptfds,
			  timeout, sigmask);

  if (![NSThread isMainThread]
      || (timeout && timeout->tv_sec == 0 && timeout->tv_nsec == 0))
    thread_select (pselect, nfds, readfds, writefds,
		   exceptfds, timeout, sigmask);
  else
    {
      struct timespec t = {0, timeout->tv_nsec}; 
      thread_select (pselect, 0, NULL, NULL, NULL, &t, sigmask);
    }

I don't understand Emacs threads well enough but it seams that the
else block is the reason for the main thread not yielding to the
"benchmark-thread" is the Main thread will almost always pselect with
timeout {0, 0}.  But if timeout is not zeroed Emacs becomes extremely
unresponsive (but "benchmark-thread" will finish in the same amount of
time as running emacs with '-nw')

In GNU Emacs 30.0.50 (build 1, aarch64-apple-darwin23.1.0, NS
 appkit-2487.20 Version 14.1.1 (Build 23B81)) of 2023-12-20 built on
 Daniels-Air
Repository revision: 281be72422f42fcc84d43f50723a3e91b7d03cbc
Repository branch: master
Windowing system distributor 'Apple', version 10.3.2487
System Description:  macOS 14.1.1

Configured features:
ACL DBUS GLIB GNUTLS JSON LCMS2 LIBXML2 MODULES NOTIFY KQUEUE NS PDUMPER
PNG RSVG SQLITE3 THREADS TOOLKIT_SCROLL_BARS TREE_SITTER WEBP XIM ZLIB

Important settings:
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Lisp Interaction

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  minibuffer-regexp-mode: t
  line-number-mode: t
  indent-tabs-mode: t
  transient-mark-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message mailcap yank-media puny dired
dired-loaddefs rfc822 mml mml-sec password-cache epa derived epg rfc6068
epg-config gnus-util text-property-search mm-decode mm-bodies mm-encode
mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047
rfc2045 ietf-drums mm-util mail-prsvr mail-utils time-date subr-x
cl-loaddefs cl-lib rmc iso-transl tooltip cconv eldoc paren electric
uniquify ediff-hook vc-hooks lisp-float-type elisp-mode mwheel
term/ns-win ns-win ucs-normalize mule-util term/common-win tool-bar dnd
fontset image regexp-opt fringe tabulated-list replace newcomment
text-mode lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow
isearch easymenu timer select scroll-bar mouse jit-lock font-lock syntax
font-core term/tty-colors frame minibuffer nadvice seq simple cl-generic
indonesian philippine cham georgian utf-8-lang misc-lang vietnamese
tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek
romanian slovak czech european ethiopic indian cyrillic chinese
composite emoji-zwj charscript charprop case-table epa-hook
jka-cmpr-hook help abbrev obarray oclosure cl-preloaded button loaddefs
theme-loaddefs faces cus-face macroexp files window text-properties
overlay sha1 md5 base64 format env code-pages mule custom widget keymap
hashtable-print-readable backquote threads dbusbind kqueue cocoa ns
lcms2 multi-tty make-network-process emacs)

Memory information:
((conses 16 38459 8478) (symbols 48 5148 0) (strings 32 13180 1700)
 (string-bytes 1 386239) (vectors 16 10512)
 (vector-slots 8 164949 10278) (floats 8 24 23) (intervals 56 242 3)
 (buffers 992 11))




Acknowledgement sent to Daniel Pettersson <daniel@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#70032; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Sun, 12 Jan 2025 05:45:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.