This is the mail archive of the cygwin@cygwin.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]

signals and VC++


Hi,

I'm compiling programs using VC++ 6.0 w/ SP5. It would
be nice to compile everything in cygwin, but that's
not always possible. But it does make a great shell
replacement. Anyway, I'm using signals to catch the
control-c so I can end the program nicely. The handler
sets a flag, causing the while loop to bail, at which
point the program cleans up after itself...all pretty
typical stuff. This works fine when compiled via VC++
and run via DOS cmd.exe.

However, when running this VC++ compiled program in
cygwin bash shell, the signal is caught and the
handler runs, but the main program quits before the
post-while-loop clean up code can run. I've put a
bunch of cout statements after the while loop and it
typically will stop somewhere in the middle of one of
them.

It appears that the signal handler is running in a
separate thread, as I can put a delay in the handler
and then I get no post-while-loop output. It looks
like control-c is sending a kill like statement to the
main program such that it does not finish correctly.
If I compile the same program using cygwin gcc the
signals are handled fine.

So, it would appear that code compiled using VC++ and
run in cygwin shell will not handle the signals as
expected. Is this the expected behavior? Is there a
work-around for this? Am I missing something obvious?
I modifed an signal code example I found in one of the
cygwin lists to illustrate and could post to the list
is that would help explain whats going on...

VR, Charlie


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


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