From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: dhruva Newsgroups: gmane.emacs.devel Subject: Re: [andrew.maguire@ge.com: Emacs 22.1 hung after delete-process] Date: Thu, 16 Aug 2007 22:34:39 +0530 Message-ID: References: <46C404AD.8040908@gnu.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1187283897 6584 80.91.229.12 (16 Aug 2007 17:04:57 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 16 Aug 2007 17:04:57 +0000 (UTC) To: "Emacs Devel" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Aug 16 19:04:54 2007 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1ILim7-0000Pu-33 for ged-emacs-devel@m.gmane.org; Thu, 16 Aug 2007 19:04:47 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1ILim6-0000yW-Mo for ged-emacs-devel@m.gmane.org; Thu, 16 Aug 2007 13:04:46 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1ILim3-0000y5-A6 for emacs-devel@gnu.org; Thu, 16 Aug 2007 13:04:43 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1ILim1-0000xj-Q5 for emacs-devel@gnu.org; Thu, 16 Aug 2007 13:04:42 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1ILim1-0000xg-Jo for emacs-devel@gnu.org; Thu, 16 Aug 2007 13:04:41 -0400 Original-Received: from nf-out-0910.google.com ([64.233.182.184]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1ILim1-00084c-0r for emacs-devel@gnu.org; Thu, 16 Aug 2007 13:04:41 -0400 Original-Received: by nf-out-0910.google.com with SMTP id f5so193008nfh for ; Thu, 16 Aug 2007 10:04:40 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=LkQo/H2ww3r3Bh8SN+cHEw9OkMYl/BBAnCdjL9bV7oglIoqkbqEiCkOUBLTGfrHH6zU6thDzDweJbgWOUk+t7PbzqVpxCrEkVxvnMTdVsFFpsZioRk1V0Rpojs3J6QmN7chf0CxdS9pEWXfV4h0/ON/sJXrvQ4ZV6vjCd7BeZHM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=dKoL7tJlBWOaTJKYafubbinuGPtU3panhHHy9L4fO7Y+XWVywaBnAY9XP7V94WGyxhTNdJkrDNTLm+kfzW5qlRUVlT8f9bxIlaCBIPHhzxFUyhd+22i07fL4Wdf6d7B8lXSnRHPZawc0ypSBTugK0gvUAIXcB1b+zAz9QzSXgWQ= Original-Received: by 10.78.201.15 with SMTP id y15mr723773huf.1187283879670; Thu, 16 Aug 2007 10:04:39 -0700 (PDT) Original-Received: by 10.78.206.20 with HTTP; Thu, 16 Aug 2007 10:04:39 -0700 (PDT) In-Reply-To: Content-Disposition: inline X-Detected-Kernel: Linux 2.6 (newer, 2) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:76634 Archived-At: Hi, I am going through the reader_thread() in w32proc.c. There is a loop in which _sys_read_ahead OR _sys_wait_accept is called. I am suspecting the thread gets into a blocking read (for _sys_read_ahead). Could this be causing a hang as the reader_thread is trying to read from a process that has been killed? Making _sys_read_ahead call ReadFile() with OVERLAPPED structure could allow us implement a cancel able IO. If the process is killed, we can set an event which will make the ReadFile() return. So, the thread calling reader_thread() can gracefully exit instead of calling a TerminateThread() (which ideally must never be called on w32). I need some guidance, I can implement it. I remember Samba implements an interruptible select() using a wait on multiple object (equivalent) by waiting on the actual socket/pipe and another pipe. Any signal handler writes a byte into the other pipe. The wait on multiple object returns and since we know which fd had data, we know it was due to an interrupt/signal. A similar implementation could be used to implement a cancel able IO, select(). -dky -- Dhruva Krishnamurthy Contents reflect my personal views only!