Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT sources DOT redhat DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT sources DOT redhat DOT com>
List-Help: <mailto:cygwin-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT sources DOT redhat DOT com
Delivered-To: mailing list cygwin AT sources DOT redhat DOT com
Date: Thu, 10 May 2001 12:55:30 -0400
From: Christopher Faylor <cgf AT redhat DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: SIGTERM does not stop backend postgres processes immediately
Message-ID: <20010510125530.A15546@redhat.com>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
References: <E94FF01DFF6CD31186F4080009DC361502086B8D AT nttwr2 DOT tower DOT bldgs DOT butlermfg DOT org> <20010510112639 DOT A26981 AT enteract DOT com> <20010510123102 DOT B15024 AT redhat DOT com> <3AFAC7C6 DOT 6576E069 AT inrialpes DOT fr>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
User-Agent: Mutt/1.3.11i
In-Reply-To: <3AFAC7C6.6576E069@inrialpes.fr>; from Olivier.Fambon@inrialpes.fr on Thu, May 10, 2001 at 06:54:30PM +0200

On Thu, May 10, 2001 at 06:54:30PM +0200, Olivier Fambon wrote:
>Christopher Faylor wrote:
>> On Thu, May 10, 2001 at 11:26:39AM -0500, Fred Yankowski wrote:
>> >To unblock recv() on receipt of a signal -- SIGHUP in particular, for
>> >this test -- I set up a signal handler that calls close() on the
>> >socket fd.  It looks to me like this should call
>> >fhandler_socket::close() on that fd, which then calls closesocket() on
>> >the underlying Win32/winsock SOCKET, which is purported to unblock
>> >the Win32 recv() call on that socket.
>> 
>> Remember this?
>> >Unfortunately, blocking recv() calls are not interruptible on Windows.
>> >I'm not aware of any mechanism for allowing this.
>> 
>> What do you think a signal handler does?  It would need to interrupt
>> a blocking recv() to work, wouldn't it?
>
>I once did something similar to what Fred Yankowski did to 'unblock' a
>socket recv(). Same trick: close the socket to 'interrupt' the syscall.
>
>... But this was in a multi-threaded process, and I was sure that the
>'closing' thread would actually close the socket in the back of the
>'blocked' thread.
>
>He does the same, but the code does not get called (coz the handler is
>not executing in a thread ?)...

Right.  That is not how signal handlers work on UNIX and it is not how
signal handlers work under Cygwin.

Microsoft does start a new thread for dealing with things like SIGINT
but Cygwin redirects those signals to the main thread.

cgf

--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple