program restarts itself automatically when run from Cygwin shell

Wed Jun 6 22:20:00 GMT 2012

My problem in brief: 

Oftentimes, when I start my command line launched console application from
Cygwin it runs through to the end and then it restarts itself from the
beginning without any intervention on my part. I've seen it automatically
restart itself and run through several times over before it finally stops
repeating. This doesn't happen every time, but it happens frequently enough
to be really annoying. I have never seen this happen when I start the
program from a standard Windows Command Prompt window.


1) My application has buils for Linux, Macintosh, and Windows systems, some
32-bit others 64-bit, using several different C++ compilers (eg., Intel,
Visual Studio, Metrowerks Codewarrior, Xcode, etc.) and various combinations
of libraries. The problem is confined to the Windows-compatible builds that
are run from a Cygwin shell, i.e., if you run any other version of the code
on a different system or you don't start the code from a Cygwin shell, you
never see this behavior, but if you run any of the Windows builds (32- or
64-bit Visual Studio C++ or 32-bit Codewarrior C++) from a Cygwin shell you
sometimes do.

2) My application can be run single or multithreaded. The number of threads
to use is a command line option. When the code starts it uses CreateThread
Windows API calls to create any additional threads it needs and before it
ends it uses CloseHandle calls to destroy them. The problem does not occur
when the program runs single threaded but can occur when two or more threads
are used.

3) My application is big and complicated and I couldn't post it for others
to experiment with even if I wanted to, so the best I can do is describe it
and answer more specific questions.

My question:

So the question is this: How do I debug this? Since the problem apparently
occurs after my program has already finished I'm at a loss as to what to do.
View this message in context:
Sent from the Cygwin list mailing list archive at

Problem reports:
Unsubscribe info:

More information about the Cygwin mailing list