Menu

using cout in Thread class

Help
Anonymous
2001-09-22
2001-09-25
  • Anonymous

    Anonymous - 2001-09-22

    Hi,
           I am using Common C++ Thread class for my Project. My thread uses cout function to output some debugging information to the stdout. But it does not work. Is there any problem in using cout  function with Common C++ Library.

    Thanks,
    Latha

     
    • David Sugar

      David Sugar - 2001-09-25

      Depending on how you use it I suppose it is possible to get interleaving I/O from different threads.  You could use a mutex shared between your thread classes to protect against this.  Alternately you can use slog rather than cout for outputting debugging messages; slog is gaurenteed to be thread atomic.

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.