playing with some different block/cache sizes I got an error #1784 = ERROR_INVALID_USER_BUFFER
in serve (WriteFile wincall_file / VC9). Error produces character output while the main thread writes to stdout resulting in character salad.
I assume that you only complain about the character salad, not the error message itself.
Is the message of the main program related to the failure?
This happens on Windows only, Linux synchronizes line-wise anyway.
How would you synchronize with an arbitrary stdout output by the main program.
I'm not complaining about ERROR_INVALID_USER_BUFFER (buffers got invalidated before written).
The message from the main thread is not related to the failure. It displays some diagnostics.
At the first sight I would use a thread mutex in verbose.cpp:print_msg, since I am using STXXL_MSG,…
for diagnostic output. A more sophisticated way could be a synched streambuf for the std::cout.
Sorry for complaining.
The character salad seems to be a result of my buffer mismanagement.
std::basic_ostream<> comes with synch support (vc9).
Nevertheless Windows provides no line-wise synchronization.
cout << "…\n"; // ok
cout << "…" << std::endl; // not synched