From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Alan Third Newsgroups: gmane.emacs.devel Subject: Creating a separate GUI thread for NS Date: Sat, 27 Jan 2018 11:14:57 +0000 Message-ID: <20180127111457.GA66552@breton.holly.idiocy.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: blaine.gmane.org 1517051636 10245 195.159.176.226 (27 Jan 2018 11:13:56 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 27 Jan 2018 11:13:56 +0000 (UTC) User-Agent: Mutt/1.9.1 (2017-09-22) To: Emacs-Devel devel Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Jan 27 12:13:52 2018 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 1efOQZ-0001lG-Jz for ged-emacs-devel@m.gmane.org; Sat, 27 Jan 2018 12:13:43 +0100 Original-Received: from localhost ([::1]:42132 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1efOSY-00051i-IM for ged-emacs-devel@m.gmane.org; Sat, 27 Jan 2018 06:15:46 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:55703) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1efORr-00051E-Eh for emacs-devel@gnu.org; Sat, 27 Jan 2018 06:15:04 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1efORq-0001K0-KH for emacs-devel@gnu.org; Sat, 27 Jan 2018 06:15:03 -0500 Original-Received: from mail-wr0-x232.google.com ([2a00:1450:400c:c0c::232]:35279) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1efORq-0001JZ-CQ for emacs-devel@gnu.org; Sat, 27 Jan 2018 06:15:02 -0500 Original-Received: by mail-wr0-x232.google.com with SMTP id w50so2610864wrc.2 for ; Sat, 27 Jan 2018 03:15:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20161025; h=sender:date:from:to:subject:message-id:mime-version :content-disposition:content-transfer-encoding:user-agent; bh=PtcZRd9X64sdmC/Fs4aQq0PEgz2mgxzelh5pdOoS0WE=; b=V/k+hdtaX3C5CwXzr9eEeegYvkPKrlZsIJstO4ukUJa0BSxR2+KMW5bZQaI1htt6uk G7qiLeDyHRCJo3oArlSiia96u0Zf74FMaJaASOou9dd3l5x+AJ3ACrOsgyVAI6LdDOJQ KNigE34UrYeMRA31fwD1z6TYKa2u74FE6r2xc9cKRcvPjItdPytFIwW5litgiwkJZxev DkZBP6QiRyEFfFr00eJYTVLIEl91aV6/Mc2b2Kcs1abe6nCsETh/AINtFAZmKFwaMEDf 4fycY9GJHMnjDNoLV3pusRwYyvnL8aobk0FFvA01oo6i1fNQh7lL7S6D/n+MPUpR2Id6 SIhw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:subject:message-id :mime-version:content-disposition:content-transfer-encoding :user-agent; bh=PtcZRd9X64sdmC/Fs4aQq0PEgz2mgxzelh5pdOoS0WE=; b=eX8f9zo50WwMg+CtnkZW2MPxE5XBj9N59jjM6ta49o+KjEXuRKX/j3jrX4hX8CPrl1 i6m2wZ0dqXc1yovnCG2fLEgNNN3OWUoec8R6ll8Icd+/swYy9Twtv9pHemUsZlb8khkS m57a0chSUeulOE8GXSUMoLcx+fgFq1LUdVphNWwu7+XSMicwcSCqZVJbV70uaO9s6zbp r9OoHFYerryAn4KPeffO3wcCp7/kRc+gFthTml47gRio0XQ0u6sN4Jb6kOnK+AY2HOxy C+DMG7AmBLEaDq2rezMNlqOe+QwtZysz0IB4yJVL5n5GgdOujFdOZUbZlt48v4SItdvf tr5Q== X-Gm-Message-State: AKwxytfQ6PQMzA4gDeqfxxnhuvyROThP1dJrrcUld3586QdsSYOIzx2L w2WSkSv/koXvM6tx0J8zJWxtts1F X-Google-Smtp-Source: AH8x2264jpXOgtrQNt1ceXdzKVE7yiyS94QyWEcXFopnYCuGN1PFHyw7CvEFTXTH07CSirVGvYqymA== X-Received: by 10.223.154.72 with SMTP id z66mr3803937wrb.209.1517051700743; Sat, 27 Jan 2018 03:15:00 -0800 (PST) Original-Received: from breton.holly.idiocy.org (ip6-2001-08b0-03f8-8129-c11a-0dde-7e09-1b0e.holly.idiocy.org. [2001:8b0:3f8:8129:c11a:dde:7e09:1b0e]) by smtp.gmail.com with ESMTPSA id l41sm16623314wrl.1.2018.01.27.03.14.59 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 27 Jan 2018 03:14:59 -0800 (PST) Content-Disposition: inline X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::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:222263 Archived-At: Cocoa and GNUstep have this thing called a ‘run loop’, that handles all the GUI windows and IO and so on. At the moment we have a complicated system where we run it from ns_select, while the real select runs in a separate thread, and we then synchronise them with message passing. There are some unfortunate side effects like not being able to update the frame while it’s being resized because we can’t break out of the run loop to run redisplay. The sensible thing to do would be to move the run loop to its own thread. I believe we do something similar on Windows. The problem is that Cocoa insists the run loop *must* be run on the main thread, and Emacs also insists that *it* runs on the main thread. Is there a way to get Emacs to run on a child thread? Is it just a case of resetting main_thread_id in sysdep.c? Thanks! -- Alan Third