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: MPS: w32 threads Date: Sat, 04 May 2024 16:59:47 +0300 Message-ID: <86le4pfzjg.fsf@gnu.org> References: <875xvvp3fo.fsf@gmail.com> <87r0eicht1.fsf_-_@gmail.com> <87plu29lcc.fsf@yahoo.com> <87fruyccs8.fsf@gmail.com> <86h6fegdzk.fsf@gnu.org> <86bk5lhqlx.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="14333"; mail-complaints-to="usenet@ciao.gmane.io" Cc: eller.helmut@gmail.com, luangruo@yahoo.com, emacs-devel@gnu.org To: Gerd =?utf-8?Q?M=C3=B6llmann?= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat May 04 16:00:40 2024 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 1s3FwN-0003Tz-4g for ged-emacs-devel@m.gmane-mx.org; Sat, 04 May 2024 16:00:39 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s3Fvb-0003ux-I0; Sat, 04 May 2024 09:59:51 -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 1s3Fva-0003up-Su for emacs-devel@gnu.org; Sat, 04 May 2024 09:59:50 -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 1s3Fva-00066c-FC; Sat, 04 May 2024 09:59:50 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=MYKmSnNuX/kwRAK+gC1+hIkfWallGfIMv5OnUMBpHYI=; b=Ff+zfkmCY9MEtQu0jWs6 iypyPikeHbNx8XqZ/bnNTQCe48jTIX5MvHyGXHM9jtaq6Dx2a3T8v8Z/2KS90spNaLgsyRdsatR9p G1TM+x/bh1hUpiycWwvdrologxrDM/9L3M/nM4OADxIYXCFe+KuNAAADSh50OcPVcvyOdITpeo0om ZvwvUyOR6at/36b5dmLawuoZwCRpMl2LtrTAK7Kl9usCvxUxIaJz/qTQZHuJ05BG8Py62PVM25EEB UFG6SUuGAxoSPRt90EDIzUWGf5Q12lhlHh177MIN4z/IFAJUFA2usTSbEhBOBrwRFsRGKd5AM/Zoj LgAneM6H5MYTUw==; In-Reply-To: (message from Gerd =?utf-8?Q?M=C3=B6llmann?= on Sat, 04 May 2024 12:04:50 +0200) 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:318746 Archived-At: > From: Gerd Möllmann > Cc: eller.helmut@gmail.com, luangruo@yahoo.com, emacs-devel@gnu.org > Date: Sat, 04 May 2024 12:04:50 +0200 > > Eli Zaretskii writes: > > > How to go about that? > > Please let's first do the thread stuff. That makes things easier for the > old man here. OK. I've started a new thread (pun intended) for this branch of the discussion. > >> I assume that the GUI thread you mention is not one the Emacs threads, > >> but something else, so it's not main_thread and not one of the threads > >> made with make-thread. > > > > It isn't a Lisp thread, that's true. But it's an "Emacs thread" in > > the sense that in the w32 build it is an integral part of Emacs, and > > without it the GUI features and GUI I/O would not work on MS-Windows. > > Does it have a struct thread_state associated with it? That's what > igc.c currently knows how to handle. No. Only Lisp threads started with make-thread have thread_state. > A thread must be registered with an arena if: > > its control stack and registers form a root (this is enforced by > mps_root_create_thread()); or it reads or writes from a location in an > automatically managed pool in the arena. However, some automatically > managed pool classes may be more liberal than this. See the > documentation for the pool class. Can you try translating this to Emacs-related terms, please? What activities in the thread should require the thread to be "registered with an arena"? Emacs on Windows starts separate threads for the following jobs: . processing Windows GUI-related messages . reading from sub-processes (part of pselect emulation) . emulation of itimers (for atimers and for M-x profiler) . file-change notifications I need to understand what traits of a thread make it need to be registered with MPS. Each of the above will then need a separate audit, I think.