X-Loop: help-debbugs@HIDDEN Subject: bug#73131: 28.2; Yielded threads get killed on C-g Resent-From: Swapneil Singh <swapneil.singh@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: bug-gnu-emacs@HIDDEN Resent-Date: Mon, 09 Sep 2024 04:09:01 +0000 Resent-Message-ID: <handler.73131.B.17258549234175 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: report 73131 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 73131 <at> debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@HIDDEN Received: via spool by submit <at> debbugs.gnu.org id=B.17258549234175 (code B ref -1); Mon, 09 Sep 2024 04:09:01 +0000 Received: (at submit) by debbugs.gnu.org; 9 Sep 2024 04:08:43 +0000 Received: from localhost ([127.0.0.1]:60446 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1snVhj-00015F-5S for submit <at> debbugs.gnu.org; Mon, 09 Sep 2024 00:08:43 -0400 Received: from lists.gnu.org ([209.51.188.17]:37654) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <swapneil.singh@HIDDEN>) id 1snKSy-0004w9-S4 for submit <at> debbugs.gnu.org; Sun, 08 Sep 2024 12:08:46 -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 <swapneil.singh@HIDDEN>) id 1snKSw-000361-4j for bug-gnu-emacs@HIDDEN; Sun, 08 Sep 2024 12:08:42 -0400 Received: from mail-lj1-x22a.google.com ([2a00:1450:4864:20::22a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from <swapneil.singh@HIDDEN>) id 1snKSu-0007U8-2c for bug-gnu-emacs@HIDDEN; Sun, 08 Sep 2024 12:08:41 -0400 Received: by mail-lj1-x22a.google.com with SMTP id 38308e7fff4ca-2f75a81b6d5so13316791fa.1 for <bug-gnu-emacs@HIDDEN>; Sun, 08 Sep 2024 09:08:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1725811717; x=1726416517; darn=gnu.org; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=53n38UCyrK2Ng0/uo93et2fx9YbKeqNFxgP3iPNeHZc=; b=NMqomuqbnQ1bfKnaWi5GJNzd+R6emKHKPeEfB02+EgJHK1mHjwhuk4kISEEzaUD0k8 h7xfaUadHDriPWFL8GLrJLBDv6/MwqpHV5rhlrA1DfLOEJH3E+H7cTzU11LAKLwNlyov LQsSiOZN4xrLRGZfOEUR1BhEbQtAF0yjuWzEP1vzs92/Rd7cBuI7Jm+3v+8fG+6fwB/S 9uSqaTgYdlR6NnhTTWprTVsIU5Hi0bFfLgouami2My3uTR1hlSHuydTGXpB5g3Lvj4SK AF5Cw4TXh9RkWTm8RayXRr0WU2BU+lk/bGA6MY6mZobwnll0YdwsRj2KZzeQtn39Qidp 51Kg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725811717; x=1726416517; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=53n38UCyrK2Ng0/uo93et2fx9YbKeqNFxgP3iPNeHZc=; b=eeufBgYS/tyu9BP8DWnSj+ahmulk9Dt7uAdZXnidbkCBuQjNdP/QMtQgiWn9PzRPHN xc9fg/xt4sSXtj6NQlZBo0dplYBph5gd4ST7vDGbhXsKzhdLoe+0226qXXYqC9fVw6q+ ZePljQ2WgYMV0PbG0p9V4o4/DXqfKR84E8g0Fwo1Tdtiz9WaJtnSIMVhR7XcyT4Fj+4O aVWiBYf/AUMfIttF5M1KiJZK/3YXWIGw/UCi5Zh+fCz3CC8YesxOBvI14i3li5ozUc7/ fYIjFgKbx4/4o/EvwNtGSo8kXpO51ERjqRxdwBraoKkGg8vB8AhSijZBOMtiAJaiiFYr AyZA== X-Gm-Message-State: AOJu0YyCD8/2Zp83FmweeDlVk8QUZRw8J1/qpgPNAbvPe1KYxON30/P6 vzz6NkjQme76iRsVQMjFq+GSk+5XidukeGMpoUxNWmqkd8H5hs3a37x4xe0qDUmMjFAqf1j1arA ZCqp63zQjwe3YBaBKKgBnGsX+w3TIn4WR X-Google-Smtp-Source: AGHT+IGaenDRzxlTy+57E5LKwNvWFJ8y/SI8F1j5PSKyF+0PjvvXC+cYyr5WJht8FJ5PKi4K0232oyPb8R4GpX1/Ke4= X-Received: by 2002:a2e:f12:0:b0:2f3:f358:8657 with SMTP id 38308e7fff4ca-2f751f8ff97mr51008091fa.44.1725811716382; Sun, 08 Sep 2024 09:08:36 -0700 (PDT) MIME-Version: 1.0 From: Swapneil Singh <swapneil.singh@HIDDEN> Date: Sun, 8 Sep 2024 12:08:00 -0400 Message-ID: <CANpN7avxL3f6TOV5XkjO8+Sa21dWO_vco1VdOyDeoKU6j-oohQ@HIDDEN> Content-Type: text/plain; charset="UTF-8" Received-SPF: pass client-ip=2a00:1450:4864:20::22a; envelope-from=swapneil.singh@HIDDEN; helo=mail-lj1-x22a.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.3 (-) X-Mailman-Approved-At: Mon, 09 Sep 2024 00:08:40 -0400 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: -2.3 (--) When using the Emacs cooperative threading system in a new project, I noticed that calling C-g results in quitting the background thread I create, even when those threads are yielded. Sending this as a bug report per Eli Zaretskii's mention that it may not be expected behavior (https://www.reddit.com/r/emacs/comments/1fbkkii/comment/lm3boja/). Repro recipe: - emacs -Q - `C-x 3` and run `list-threads` in the new window, then return to the older window - `M-:` `(make-thread (lambda () (cl-loop while t do (progn (thread-yield) (sleep-for 30)))))` and wait for the new thread to yield to the main thread. - `C-g`. The new thread disappears from the `list-threads` window. Note: While I am admittedly on Windows, given this behavior is within the cooperative threads of the Emacs runtime (rather than actual Windows threads) I *really* doubt that has anything to do with it. In GNU Emacs 28.2 (build 2, x86_64-w64-mingw32) of 2022-09-13 built on AVALON Windowing system distributor 'Microsoft Corp.', version 10.0.22631 System Description: Microsoft Windows 10 Home (v10.0.2009.22631.4037) Configured using: 'configure --with-modules --without-dbus --with-native-compilation --without-compress-install CFLAGS=-O2' Configured features: ACL GIF GMP GNUTLS HARFBUZZ JPEG JSON LCMS2 LIBXML2 MODULES NATIVE_COMP NOTIFY W32NOTIFY PDUMPER PNG RSVG SOUND THREADS TIFF TOOLKIT_SCROLL_BARS XPM ZLIB Important settings: value of $LC_CTYPE: en_US.UTF-8 value of $LANG: ENU locale-coding-system: cp1252 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 auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t line-number-mode: t indent-tabs-mode: t transient-mark-mode: t Load-path shadows: None found. Features: (shadow sort mail-extr emacsbug message rmc puny dired dired-loaddefs rfc822 mml mml-sec epa derived epg rfc6068 epg-config gnus-util rmail rmail-loaddefs auth-source eieio eieio-core eieio-loaddefs password-cache json map text-property-search time-date mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils mule-util thread backtrace find-func novice comp comp-cstr warnings subr-x rx cl-seq cl-macs cl-extra help-mode seq byte-opt gv cl-loaddefs cl-lib bytecomp byte-compile cconv iso-transl tooltip eldoc paren electric uniquify ediff-hook vc-hooks lisp-float-type elisp-mode mwheel dos-w32 ls-lisp disp-table term/w32-win w32-win w32-vars 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 cl-generic 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 simple abbrev obarray cl-preloaded nadvice button loaddefs faces cus-face macroexp files window text-properties overlay sha1 md5 base64 format env code-pages mule custom widget hashtable-print-readable backquote threads w32notify w32 lcms2 multi-tty make-network-process native-compile emacs) Memory information: ((conses 16 84196 8508) (symbols 48 8108 1) (strings 32 24204 4130) (string-bytes 1 796675) (vectors 16 17957) (vector-slots 8 324199 20918) (floats 8 36 215) (intervals 56 256 36) (buffers 992 15))
Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) Content-Type: text/plain; charset=utf-8 X-Loop: help-debbugs@HIDDEN From: help-debbugs@HIDDEN (GNU bug Tracking System) To: Swapneil Singh <swapneil.singh@HIDDEN> Subject: bug#73131: Acknowledgement (28.2; Yielded threads get killed on C-g) Message-ID: <handler.73131.B.17258549234175.ack <at> debbugs.gnu.org> References: <CANpN7avxL3f6TOV5XkjO8+Sa21dWO_vco1VdOyDeoKU6j-oohQ@HIDDEN> X-Gnu-PR-Message: ack 73131 X-Gnu-PR-Package: emacs Reply-To: 73131 <at> debbugs.gnu.org Date: Mon, 09 Sep 2024 04:09:02 +0000 Thank you for filing a new bug report with debbugs.gnu.org. This is an automatically generated reply to let you know your message has been received. Your message is being forwarded to the package maintainers and other interested parties for their attention; they will reply in due course. Your message has been sent to the package maintainer(s): bug-gnu-emacs@HIDDEN If you wish to submit further information on this problem, please send it to 73131 <at> debbugs.gnu.org. Please do not send mail to help-debbugs@HIDDEN unless you wish to report a problem with the Bug-tracking system. --=20 73131: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D73131 GNU Bug Tracking System Contact help-debbugs@HIDDEN with problems
X-Loop: help-debbugs@HIDDEN Subject: bug#73131: 28.2; Yielded threads get killed on C-g Resent-From: Andrea Corallo <acorallo@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: bug-gnu-emacs@HIDDEN Resent-Date: Mon, 09 Sep 2024 06:50:02 +0000 Resent-Message-ID: <handler.73131.B73131.17258645685487 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: followup 73131 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Swapneil Singh <swapneil.singh@HIDDEN> Cc: 73131 <at> debbugs.gnu.org Received: via spool by 73131-submit <at> debbugs.gnu.org id=B73131.17258645685487 (code B ref 73131); Mon, 09 Sep 2024 06:50:02 +0000 Received: (at 73131) by debbugs.gnu.org; 9 Sep 2024 06:49:28 +0000 Received: from localhost ([127.0.0.1]:60557 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1snYDI-0001QR-3V for submit <at> debbugs.gnu.org; Mon, 09 Sep 2024 02:49:28 -0400 Received: from eggs.gnu.org ([209.51.188.92]:42502) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <acorallo@HIDDEN>) id 1snYDG-0001QF-DB for 73131 <at> debbugs.gnu.org; Mon, 09 Sep 2024 02:49:27 -0400 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 <acorallo@HIDDEN>) id 1snYB2-0006al-8T; Mon, 09 Sep 2024 02:47:08 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To: From; bh=fRUs1sD2EO73S54txaF3NA3sBrjfttGLg/GxEg3/6Rk=; b=F+dwJdQSeF+fCkWktBsJ A6al3Mu5hSgNidr5zTQozvm0d60JxLC2Q2Bk38JJ6XaQBEse5zmpqaTxM83FzcZ2jGKfu7laq1IYk oHdJ+dfLzcFZvJjlMH+CUFspElAfbAiFEpKem6jL8WDVsTXNyRm6dGMWKowTUqdkidap3s8U/FyJx Wvb6hibQlsYb9IPdw2sRakBbDeCLWzMe3KCiUWpvReW69SY8RnvoSvrojpKGsgCzZnxzl2S2FZ4JE OXQbc6Wp3SEKzLuNu0pIOo9mDJRF40UfNz+6fDm522DLdkhudw00iR9lmRzv8tIYgOo3LTD5caeYA 1BJzibEU8LEkqg==; Received: from acorallo by fencepost.gnu.org with local (Exim 4.90_1) (envelope-from <acorallo@HIDDEN>) id 1snYB2-0006St-08; Mon, 09 Sep 2024 02:47:08 -0400 From: Andrea Corallo <acorallo@HIDDEN> In-Reply-To: <CANpN7avxL3f6TOV5XkjO8+Sa21dWO_vco1VdOyDeoKU6j-oohQ@HIDDEN> (Swapneil Singh's message of "Sun, 8 Sep 2024 12:08:00 -0400") References: <CANpN7avxL3f6TOV5XkjO8+Sa21dWO_vco1VdOyDeoKU6j-oohQ@HIDDEN> Date: Mon, 09 Sep 2024 02:47:07 -0400 Message-ID: <yp1wmjl8gt0.fsf@HIDDEN> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.3 (--) 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: -3.3 (---) Swapneil Singh <swapneil.singh@HIDDEN> writes: > When using the Emacs cooperative threading system in a new project, I > noticed that calling C-g results in quitting the background thread I > create, even when those threads are yielded. > > Sending this as a bug report per Eli Zaretskii's mention that it may not > be expected behavior > (https://www.reddit.com/r/emacs/comments/1fbkkii/comment/lm3boja/). > > Repro recipe: > - emacs -Q > - `C-x 3` and run `list-threads` in the new window, then return to the > older window > - `M-:` `(make-thread (lambda () (cl-loop while t do (progn > (thread-yield) (sleep-for 30)))))` and wait for the new thread to yield to > the main thread. > - `C-g`. The new thread disappears from the `list-threads` window. > > > Note: While I am admittedly on Windows, given this behavior is within the > cooperative threads of the Emacs runtime (rather than actual Windows > threads) I *really* doubt that has anything to do with it. Data point: I might be doing something different but I can't reproduce this here on emacs-29.4 nor on emacs30 on GNU/Linux. Andrea
X-Loop: help-debbugs@HIDDEN Subject: bug#73131: 28.2; Yielded threads get killed on C-g Resent-From: Eli Zaretskii <eliz@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: bug-gnu-emacs@HIDDEN Resent-Date: Mon, 09 Sep 2024 12:24:02 +0000 Resent-Message-ID: <handler.73131.B73131.17258845838028 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: followup 73131 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Swapneil Singh <swapneil.singh@HIDDEN> Cc: 73131 <at> debbugs.gnu.org Received: via spool by 73131-submit <at> debbugs.gnu.org id=B73131.17258845838028 (code B ref 73131); Mon, 09 Sep 2024 12:24:02 +0000 Received: (at 73131) by debbugs.gnu.org; 9 Sep 2024 12:23:03 +0000 Received: from localhost ([127.0.0.1]:60831 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1sndQ6-00025Q-UX for submit <at> debbugs.gnu.org; Mon, 09 Sep 2024 08:23:03 -0400 Received: from eggs.gnu.org ([209.51.188.92]:56750) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1sndQ5-00024s-Hz for 73131 <at> debbugs.gnu.org; Mon, 09 Sep 2024 08:23:02 -0400 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 <eliz@HIDDEN>) id 1sndPw-0007KX-JV; Mon, 09 Sep 2024 08:22:52 -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=J6Q4EponyVgpr0eQqpD1F9SBsUyttx0807HqeCrjGiA=; b=UOvjnPeU3VF6 JDmcYUTaA6ZJg8PoNO5vQkxbzWTUjCJMuB0kEnw5XEZtT2jmJHkSORrDPrO/sGQb2dBQLeb8Alp5r XPFgMYWhPgthk53pXjL7x9ADd8Z/lgY87ghP08emkPMzPrd9xaJuhvojKxuJt9WBTJ73QFkSELlYd 8oQ0D/gSFQIfIakKJQZlYzZDJY8X4D9gE73+Ew3iUln7rX2qMUJ26s8BiFHGNscT4S3OgPVqxqeyo gyZIe95yTT3nVgNDtLOOKXktsnkVeWhemyBDJjrTjooA6TS+o4zXU1HGMzCqHKzAkYU52u2ZvlAue +Wl2gF5GkXVAjo8aYu5Sxg==; Date: Mon, 09 Sep 2024 15:22:48 +0300 Message-Id: <861q1tvwx3.fsf@HIDDEN> From: Eli Zaretskii <eliz@HIDDEN> In-Reply-To: <CANpN7avxL3f6TOV5XkjO8+Sa21dWO_vco1VdOyDeoKU6j-oohQ@HIDDEN> (message from Swapneil Singh on Sun, 8 Sep 2024 12:08:00 -0400) References: <CANpN7avxL3f6TOV5XkjO8+Sa21dWO_vco1VdOyDeoKU6j-oohQ@HIDDEN> X-Spam-Score: -2.3 (--) 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: -3.3 (---) > From: Swapneil Singh <swapneil.singh@HIDDEN> > Date: Sun, 8 Sep 2024 12:08:00 -0400 > > When using the Emacs cooperative threading system in a new project, I > noticed that calling C-g results in quitting the background thread I > create, even when those threads are yielded. > > Sending this as a bug report per Eli Zaretskii's mention that it may not > be expected behavior > (https://www.reddit.com/r/emacs/comments/1fbkkii/comment/lm3boja/). > > Repro recipe: > - emacs -Q > - `C-x 3` and run `list-threads` in the new window, then return to the > older window > - `M-:` `(make-thread (lambda () (cl-loop while t do (progn > (thread-yield) (sleep-for 30)))))` and wait for the new thread to yield to > the main thread. > - `C-g`. The new thread disappears from the `list-threads` window. > > > Note: While I am admittedly on Windows, given this behavior is within the > cooperative threads of the Emacs runtime (rather than actual Windows > threads) I *really* doubt that has anything to do with it. Actually, your being on MS-Windows does explain what you see, because the way C-g is processed is system-dependent. When I said "this is not supposed to happen", I assumed you were doing this on GNU/Linux or another Posix platform. Indeed, on MS-Windows this is expected behavior: pressing C-g in the above scenario will set the quit-flag, and the loop will then quit. To prevent that, you need to use this simple technique: (make-thread (lambda () (let ((inhibit-quit t)) ;; <<<<<<<<<<<<<<<<<<<< (cl-loop while t do (progn (thread-yield) (sleep-for 30)))))) Btw, my recommendation is to bind inhibit-quit non-nil around the thread functions in all cases, if you want background thread to never be interrupted by C-g and the like.
X-Loop: help-debbugs@HIDDEN Subject: bug#73131: 28.2; Yielded threads get killed on C-g Resent-From: Swapneil Singh <swapneil.singh@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: bug-gnu-emacs@HIDDEN Resent-Date: Tue, 10 Sep 2024 05:48:02 +0000 Resent-Message-ID: <handler.73131.B73131.172594725021935 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: followup 73131 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Eli Zaretskii <eliz@HIDDEN> Cc: 73131 <at> debbugs.gnu.org Received: via spool by 73131-submit <at> debbugs.gnu.org id=B73131.172594725021935 (code B ref 73131); Tue, 10 Sep 2024 05:48:02 +0000 Received: (at 73131) by debbugs.gnu.org; 10 Sep 2024 05:47:30 +0000 Received: from localhost ([127.0.0.1]:34644 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1sntir-0005hj-Sw for submit <at> debbugs.gnu.org; Tue, 10 Sep 2024 01:47:30 -0400 Received: from mail-lf1-f54.google.com ([209.85.167.54]:45304) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <swapneil.singh@HIDDEN>) id 1sntip-0005hU-Px for 73131 <at> debbugs.gnu.org; Tue, 10 Sep 2024 01:47:28 -0400 Received: by mail-lf1-f54.google.com with SMTP id 2adb3069b0e04-5365c060f47so4331515e87.2 for <73131 <at> debbugs.gnu.org>; Mon, 09 Sep 2024 22:47:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1725947177; x=1726551977; darn=debbugs.gnu.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=AD8VlH6UIzfV6JUAgJ8vxNNUGEhrVZBlzpPQh1fsi+k=; b=ZvaAITNjwjtSsEPOmdDQnr0mAgbnJO1P5cC75smc7WYSs1Opuvxv2tDpXqXabAabYm fu0bcp4nVSytwYlsGxxBnNWtjF3Mu5qEuESz3DXQIUiMqxOoGBKsBAEKDwkUz3/rA1A2 rfaGdHbuGXsvVlGGHQRdNe1rgjim2BiaJmPN4v8kFEjFttr5o9Fs0z+eCE5Czd2/7nIY mjsHE74E4Do/T87PByqRIv7fF7ZIDe17/uZ/e+oEbyWb+OE4mGkWMut94cENrkzciNHs jWoCb1WvYWliiL0zQHZe/K1i4ruWqzxeAb4q7RL1ruNzj0xdvUHJqDPfhRusuWYHmteU U5xA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725947177; x=1726551977; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=AD8VlH6UIzfV6JUAgJ8vxNNUGEhrVZBlzpPQh1fsi+k=; b=MNfFdR/sw9Oyqh+cckdWL4cvyFyZU1mz9CKyTf+NQQt76y5UOkwyHR9Q2TuZSD07m5 yFdJMHEoMRohKJZDGkYUg0D+Idoll8YZhj5L+BbnuZwXtYhHQQZTtH+j6cWJjYTyjf4q Rb9cg00B3IZ7AxeEt+MZw7+l2FrBRFMmrhpQx4CHaqetgTy2Ml0GtAFMsqxPlDB8u1Yk Qn1bS74J9vyk/jUtMr88VBIskauz9QfQsunoejmBPsc3pes9A5QWSshriIbRkU2jzFPo 1SziadPJ6G8AE573gLOkWy4Nt1+F5FzA4V9QHWnQlyyklVHuYJba04R7Jp5Hur/kkoAC 7Ibg== X-Gm-Message-State: AOJu0YydyJ6sHtd73YNrd8jmDnSC1BGj4Mlyi3j3+0bcbz4uGsipPSR0 pgUHw9g4nS5nANzZAsguHjXr5+37E59l1Dt3XI8mM43SrC3YKUXKn4oTUyjfOLJxcxGmQfWoemp iVPihs9SHyWmY5HkOhItm/vTn+7UHcQ== X-Google-Smtp-Source: AGHT+IElrgwHz0AGlDNYm7lK5Yg5+LNxKsMWA+M4uBzacf1M5sbaPV3mIl1eaJOeHid8yybEixNnsrsDDBU+X2sbCGY= X-Received: by 2002:a05:6512:3b82:b0:52c:cca8:a9fb with SMTP id 2adb3069b0e04-536587f56fcmr9538763e87.42.1725947176090; Mon, 09 Sep 2024 22:46:16 -0700 (PDT) MIME-Version: 1.0 References: <CANpN7avxL3f6TOV5XkjO8+Sa21dWO_vco1VdOyDeoKU6j-oohQ@HIDDEN> <861q1tvwx3.fsf@HIDDEN> In-Reply-To: <861q1tvwx3.fsf@HIDDEN> From: Swapneil Singh <swapneil.singh@HIDDEN> Date: Tue, 10 Sep 2024 01:45:39 -0400 Message-ID: <CANpN7asmHxxgqoYa=0uvr0UBYV4hMUjFD5hJSmWYE0Qo88FwOQ@HIDDEN> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.0 (/) 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 (-) inhibit-quit works great, thanks for the fix! On Mon, Sep 9, 2024 at 8:22=E2=80=AFAM Eli Zaretskii <eliz@HIDDEN> wrote: > > > From: Swapneil Singh <swapneil.singh@HIDDEN> > > Date: Sun, 8 Sep 2024 12:08:00 -0400 > > > > When using the Emacs cooperative threading system in a new project, I > > noticed that calling C-g results in quitting the background thread I > > create, even when those threads are yielded. > > > > Sending this as a bug report per Eli Zaretskii's mention that it may no= t > > be expected behavior > > (https://www.reddit.com/r/emacs/comments/1fbkkii/comment/lm3boja/). > > > > Repro recipe: > > - emacs -Q > > - `C-x 3` and run `list-threads` in the new window, then return to the > > older window > > - `M-:` `(make-thread (lambda () (cl-loop while t do (progn > > (thread-yield) (sleep-for 30)))))` and wait for the new thread to yield= to > > the main thread. > > - `C-g`. The new thread disappears from the `list-threads` window. > > > > > > Note: While I am admittedly on Windows, given this behavior is within t= he > > cooperative threads of the Emacs runtime (rather than actual Windows > > threads) I *really* doubt that has anything to do with it. > > Actually, your being on MS-Windows does explain what you see, because > the way C-g is processed is system-dependent. When I said "this is > not supposed to happen", I assumed you were doing this on GNU/Linux or > another Posix platform. > > Indeed, on MS-Windows this is expected behavior: pressing C-g in the > above scenario will set the quit-flag, and the loop will then quit. > To prevent that, you need to use this simple technique: > > (make-thread > (lambda () > (let ((inhibit-quit t)) ;; <<<<<<<<<<<<<<<<<<<< > (cl-loop > while t do > (progn > (thread-yield) > (sleep-for 30)))))) > > Btw, my recommendation is to bind inhibit-quit non-nil around the > thread functions in all cases, if you want background thread to never > be interrupted by C-g and the like.
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997 nCipher Corporation Ltd,
1994-97 Ian Jackson.