Thread: cout and multithreading

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User ~Kyo~'s Avatar
    Join Date
    Jun 2004
    Posts
    320

    cout and multithreading

    So I noticed an issue tonight while testing a multithreaded program. In the effect of if two threads both try to cout at the same time they cut into each other, but not only that - it seems to have broken cout as all output to the console after that point never showed up. I use endl which if I remember flushes the stream after the call which doesn't clear the issue up. I am jsut curious what would be locked to keep the system from doing this to itself. For now I am removing the older cout as it was there for letting me know a connection was being culled from the server and the new one does the same just a bit more implementation specific. Looks like it broke fstream as well as the output file is mangled.... lol.
    Last edited by ~Kyo~; 09-17-2011 at 01:07 AM. Reason: Adding more info

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Multithreading.
    By kevinawad in forum C++ Programming
    Replies: 5
    Last Post: 10-21-2008, 12:12 PM
  2. std::cout or using namespace std or using std::cout
    By ComDriver in forum C++ Programming
    Replies: 13
    Last Post: 01-31-2005, 11:54 AM
  3. Whats the difference between cout and std::cout?
    By mdshort in forum C++ Programming
    Replies: 10
    Last Post: 12-30-2003, 05:34 PM
  4. multithreading
    By thedumbmutt in forum A Brief History of Cprogramming.com
    Replies: 1
    Last Post: 11-13-2002, 11:54 AM
  5. Multithreading :: MFC
    By kuphryn in forum Windows Programming
    Replies: 2
    Last Post: 10-03-2002, 08:39 AM