From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#19688: [patch] add support for emacs daemon on Windows Date: Sat, 14 Feb 2015 17:24:42 +0200 Message-ID: <83r3tswm6d.fsf@gnu.org> References: <83h9ver459.fsf@gnu.org> <83d262qdx6.fsf@gnu.org> <54C62B6C.3050608@dancol.org> <834mr8n5or.fsf@gnu.org> <83pp9e42n8.fsf@gnu.org> <8361b4y9qj.fsf@gnu.org> <83wq3kwrjx.fsf@gnu.org> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1423927525 2575 80.91.229.3 (14 Feb 2015 15:25:25 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 14 Feb 2015 15:25:25 +0000 (UTC) Cc: 19688@debbugs.gnu.org To: Mark Laws Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Feb 14 16:25:15 2015 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1YMeam-0003bW-7V for geb-bug-gnu-emacs@m.gmane.org; Sat, 14 Feb 2015 16:25:12 +0100 Original-Received: from localhost ([::1]:60156 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YMeal-0003Oe-D2 for geb-bug-gnu-emacs@m.gmane.org; Sat, 14 Feb 2015 10:25:11 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:49363) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YMeah-0003La-NH for bug-gnu-emacs@gnu.org; Sat, 14 Feb 2015 10:25:08 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YMeac-0006Je-R1 for bug-gnu-emacs@gnu.org; Sat, 14 Feb 2015 10:25:07 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:52708) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YMeac-0006JU-NK for bug-gnu-emacs@gnu.org; Sat, 14 Feb 2015 10:25:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1YMeac-0001ks-DV for bug-gnu-emacs@gnu.org; Sat, 14 Feb 2015 10:25:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 14 Feb 2015 15:25:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 19688 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 19688-submit@debbugs.gnu.org id=B19688.14239274936727 (code B ref 19688); Sat, 14 Feb 2015 15:25:02 +0000 Original-Received: (at 19688) by debbugs.gnu.org; 14 Feb 2015 15:24:53 +0000 Original-Received: from localhost ([127.0.0.1]:43948 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YMeaS-0001kR-BB for submit@debbugs.gnu.org; Sat, 14 Feb 2015 10:24:52 -0500 Original-Received: from mtaout24.012.net.il ([80.179.55.180]:38621) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YMeaP-0001kC-2Q for 19688@debbugs.gnu.org; Sat, 14 Feb 2015 10:24:50 -0500 Original-Received: from conversion-daemon.mtaout24.012.net.il by mtaout24.012.net.il (HyperSendmail v2007.08) id <0NJR00I00OMUW300@mtaout24.012.net.il> for 19688@debbugs.gnu.org; Sat, 14 Feb 2015 17:16:24 +0200 (IST) Original-Received: from HOME-C4E4A596F7 ([87.69.4.28]) by mtaout24.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0NJR00H12P3C5N30@mtaout24.012.net.il>; Sat, 14 Feb 2015 17:16:24 +0200 (IST) In-reply-to: X-012-Sender: halo1@inter.net.il X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:99390 Archived-At: > Date: Sat, 14 Feb 2015 22:37:55 +0900 > From: Mark Laws > Cc: 19688@debbugs.gnu.org > > On Sat, Feb 14, 2015 at 10:28 PM, Eli Zaretskii wrote: > > I don't see why 'WaitForInputIdle' wouldn't work. Can you explain? > > AFAIU, it waits until the process is idle, which means it did all the > > initialization and is ready for accepting connections. Am I missing > > something? > > http://blogs.msdn.com/b/oldnewthing/archive/2010/03/26/9985422.aspx Thanks, it's good to know about those subtleties. However, after looking at the Emacs initialization code, I think those problems will not affect Emacs, because we only start the thread that reads Windows messages inside the call to Frecursive_edit, and by that time the daemon initialization is already done. OTOH, there's one other caveat in the documentation of 'WaitForInputIdle': it returns immediately "if the process is a console application or does not have a message queue". Emacs is built as a console application, and I'm not sure at which point it begins to "have a message queue", as far as this function is concerned. > I can try it if you want, but it seems fragile compared to the event thing. Please do try it, I think it will either work reliably or not at all. The reason I'd prefer to use it if it works is because doing so side-steps the entire issue of how to pass the event ID, which, together with the code which handles the event, adds non-trivial amount of code to your patch. It would be nice to avoid that, if possible. Thanks.