print_msg needs to be synched

  • Edgar

    Edgar - 2011-02-10


    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.


  • Johannes Singler

    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.


  • Nobody/Anonymous

    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.


  • Nobody/Anonymous

    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



Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.

No, thanks