I have a C ++ program containing several cout statements. I guaranteed that they all end in endl . My problem is that the program rarely stops until the user presses Enter (so I assume that the output buffer does not always turn red as it should). Pressing the button resumes the program. This is quite problematic, since my program takes several hours, so I can not afford to click all the time! Please note that sometimes the program stops after a minute and other hours after more than an hour.
Here is a small piece of code:
for(int i = 0; i < _numIterations; i++){ std::cout << "Iteration " << i << std::endl;
Please note that I use Theano through the built-in Python and that my Python code also contains print instructions. My Python code only calls print, not sys.stdout.flush() after every print. However, it is very rare that program execution freezes after instructions for printing on Python. Am I missing something obvious? Should I call sys.stdout.flush() in Python code? Unfortunately, I cannot provide more code, since my program consists of dozens of classes.
[Edit] I paused the program using the debugger when it was hanging, and no source was available for display. Call stack: 
It seems the thread is waiting. However, I myself did not create these topics. They were either generated by Cuda or the Havok physics engine, which I also use. I will explore.
source share