From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Richard Copley Newsgroups: gmane.emacs.bugs Subject: bug#25875: 26.0.50; Hang logging out of MS-Windows Date: Mon, 27 Feb 2017 08:14:22 +0000 Message-ID: References: <83lgsuqacv.fsf@gnu.org> <83efylq7m4.fsf@gnu.org> <834lzgreqq.fsf@gnu.org> <3f07808e-ab1c-d6b5-9ea0-dfc4c6fd6fc9@cornell.edu> <8337f0rbz6.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: blaine.gmane.org 1488183315 3002 195.159.176.226 (27 Feb 2017 08:15:15 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 27 Feb 2017 08:15:15 +0000 (UTC) Cc: 25875@debbugs.gnu.org To: Ken Brown Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Feb 27 09:15:11 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1ciGSc-0008S5-F1 for geb-bug-gnu-emacs@m.gmane.org; Mon, 27 Feb 2017 09:15:10 +0100 Original-Received: from localhost ([::1]:50965 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ciGSf-0005L5-8n for geb-bug-gnu-emacs@m.gmane.org; Mon, 27 Feb 2017 03:15:13 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:34146) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ciGSZ-0005IZ-0z for bug-gnu-emacs@gnu.org; Mon, 27 Feb 2017 03:15:07 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ciGSU-00075h-Qu for bug-gnu-emacs@gnu.org; Mon, 27 Feb 2017 03:15:07 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:59288) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ciGSU-00075b-NQ for bug-gnu-emacs@gnu.org; Mon, 27 Feb 2017 03:15:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ciGSU-0000cD-C7 for bug-gnu-emacs@gnu.org; Mon, 27 Feb 2017 03:15:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Richard Copley Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 27 Feb 2017 08:15:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 25875 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 25875-submit@debbugs.gnu.org id=B25875.14881833002342 (code B ref 25875); Mon, 27 Feb 2017 08:15:02 +0000 Original-Received: (at 25875) by debbugs.gnu.org; 27 Feb 2017 08:15:00 +0000 Original-Received: from localhost ([127.0.0.1]:57487 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ciGSS-0000bi-2U for submit@debbugs.gnu.org; Mon, 27 Feb 2017 03:15:00 -0500 Original-Received: from mail-ua0-f169.google.com ([209.85.217.169]:34357) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ciGSQ-0000bW-E0 for 25875@debbugs.gnu.org; Mon, 27 Feb 2017 03:14:58 -0500 Original-Received: by mail-ua0-f169.google.com with SMTP id f54so17790952uaa.1 for <25875@debbugs.gnu.org>; Mon, 27 Feb 2017 00:14:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=U3arFsRWhwjI5TvlYIVzi56+B2LULZ0MnNc5Gfl7gO4=; b=XLMFcj57g+tELIRUGp2ad2OUYrrr4x38BKECbfmhoGWRTdYRQiyvIqRxUnFzJtqZ7p 4Tm7lNe6jUEgN1pA0P+CYGHBaivBDB7CA2h+D10AeuCocnk3TvvW39w1++tfdnH9lxaF droc+LbkQbsreBOuUNmMbZi1wmrVYVsuvdkNZZMdiL+skzrG4Taqa78b/jrGVNiY2qxg c8/iIR4w5Wuvlp3DLs+hjiAonlMfCdDFpiA6Bt9Xgn4WnCunHLcXJc0qV3i5CX+WNUwI lVJGL5eRaIS9hzvsynL1fGyMLUmpn+0h3oopyDJt1/+QZ7ad4ngzYfmKf68yE0Vr1CgF dh3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=U3arFsRWhwjI5TvlYIVzi56+B2LULZ0MnNc5Gfl7gO4=; b=iBgWJ2xw9fkwdfgPqZGw7th7mIbGgPluMALVxEWmxsjXtQhvKvXta3T4Wt59EuIQ1I 9Rlfyo+3OlIa6tuLjeZZXls1a8hRcIXL/qirUgKry4x+xDcUpALoJW06MIBumaaHVzn7 AqKbeX/gj+5Wu4PySz33pmysiSp3fpfijswSduZCW1bitSux1YWH3IFKBg8NN9SybQgz PUcSpnpxIxLcloT9Tn3+bJdGlyL7lDICFWz/iMnQVZpjUUZalBEwke6++TBMmGqgTMMy Rhj5L/mfYn2nIMJli6Olf5sqt5CuAjzTYubc4Gszc6QpLIVjD59RBy5/nBbBhgisyXfh c90g== X-Gm-Message-State: AMke39m40AQqVcFHHAsMwKZZVt7oWcRTXpQVyGXlsHn9eCxTfN994uRrqhHjiHm7QpWQujtMzEVkp3ytey7qwA== X-Received: by 10.31.4.211 with SMTP id 202mr6875825vke.105.1488183292817; Mon, 27 Feb 2017 00:14:52 -0800 (PST) Original-Received: by 10.176.71.214 with HTTP; Mon, 27 Feb 2017 00:14:22 -0800 (PST) In-Reply-To: X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.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" Xref: news.gmane.org gmane.emacs.bugs:129873 Archived-At: On 26 February 2017 at 23:38, Ken Brown wrote: > On 2/26/2017 2:25 PM, Eli Zaretskii wrote: >>> >>> Cc: rcopley@gmail.com, 25875@debbugs.gnu.org >>> From: Ken Brown >>> Date: Sun, 26 Feb 2017 13:58:23 -0500 >>> >>>> I think the problem in this particular scenario is not that the input >>>> thread sleeps too long, it's that whenever it finishes sleeping and >>>> returns, Emacs will be killed, so the WM_ENDSESSION message that was >>>> posted to the main thread will never have a chance to be processed, >>>> and thus orderly shutdown will never happen. >>>> >>>> That is why I thought about using SendMessageTimeout in the main >>>> thread: what we really want is to cause the main thread to wake up and >>>> process the WM_ENDSESSION message. Right? >>> >>> >>> Yes, that would obviously be better. >> >> >> OK. Can you propose a patch that Richard could try? > > > Here's a quick and dirty attempt. If I haven't made a mistake, it replaces > every relevant call to SendMessage by a call to SendMessageTimeout with a > 100ms timeout. > > --- a/src/w32term.c > +++ b/src/w32term.c > @@ -537,6 +537,15 @@ x_update_begin (struct frame *f) > } > > > +#undef SendMessage > +#define SendMessage DebugSendMessage > + > +static LRESULT WINAPI > +DebugSendMessage (HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam) > +{ > + return SendMessageTimeoutA (hWnd, Msg, wParam, lParam, 0, 100, NULL); > +} > + > /* Start update of window W. */ > > static void > > Ken Sorry Ken, I can't sabotage myself like that, I have work to do.