It is almost always due to buffering.
I add about 4 lines of code to stop buffering and then all is well.
The Windows default (full buffering) is different than the Linux default (line buffering) so people who write their engines on Linux almost never put in code to do that.
Stockfish and Cfish are examples of programs that need this change (and many others as well, I just mention them because I have to change the code so often). Now, most of the time it works fine as is. But sometimes it will get decoupled. When that happens you will see crazy things in {for instance} Arena output, such as analysis output getting associated with the wrong position.
For instance, here is how I start off main() in Cfish:
Code: Select all
int main(int argc, char **argv)
{
if( setvbuf( stdin, NULL, _IONBF, 0 ) != 0 )
printf( "Incorrect type or size of buffer for stdin\n" );
if( setvbuf( stdout, NULL, _IONBF, 0 ) != 0 )
printf( "Incorrect type or size of buffer for stdout\n" );
if( setvbuf( stderr, NULL, _IONBF, 0 ) != 0 )
printf( "Incorrect type or size of buffer for stderr\n" );
print_engine_info(0);
int i = _flushall();