This is the mail archive of the cygwin@sourceware.cygnus.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Signal SIGCHLD does not interrupt process blocked on read of pipe?


> 
> 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 <defunct>
> 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@cygnus.com" with one line of text: "help".


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]