From: newsham AT lava DOT net (Tim Newsham) Subject: Re: Signal SIGCHLD does not interrupt process blocked on read of pipe? 17 Jan 1998 04:52:36 -0800 Message-ID: References: <01BD1F8A DOT ADC70090 AT remote489 DOT compusmart DOT ab DOT ca> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit To: atuining AT compusmart DOT ab DOT ca (Anthony Tuininga) Cc: gnu-win32 AT cygnus DOT com > > I have a process which accepts requests from an Oracle database and > passes them off to a process via Oracle's "pipe" mechanism. This > process passes the information to another process which manages the > requests and processes them. What is happening is that the second > process spawns a process to handle the request and then goes back to > reading the pipe. The spawned process completes and becomes > in the process listing but the SIGCHLD handler does not get triggered! > A subsequent call (which causes the read on the pipe to terminate) > causes the SIGCHLD handler to trigger and then does exactly the same > thing!! This is really frustrating. Does anyone have any idea as to > what is going on? Signals do not interrupt blocking operations on pipes and sockets in cygwin (there may be other blocking calls that do not yield to signals as well). This is because cygwin does a blocking call into NT and gives up control of the thread until the call returns. The cygwin signal mechanism causes the thread to stop, fiddles with its stack, and then resumes the thread. This means the signal doesn't get delivered until the blocking call returns. (Signal stuff is gonna change soon (or has already?) but I assume the blocking behavior will remain the same). As a work around you can use sockets instead of pipes, and make sure to use only non-blocking socket calls (select() gets along fine with signals). You can patch your cygwin.dll to only do non-blocking socket calls if you can't or don't want to patch all of your sources. > Anthony Tuininga Tim N. - For help on using this list (especially unsubscribing), send a message to "gnu-win32-request AT cygnus DOT com" with one line of text: "help".