473,228 Members | 1,594 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,228 software developers and data experts.

Stream thread-safety

I know that std streams are not thread-safe (i.e., output can end up
becoming interleaved), but do they share mutable state? (At least in
libstdc++ 4.2 on Linux kernel 2.6.x?)

I just spent a long time tracking down a bug in my program where,
given enough threads, eventually all cout<<int would print in hex
rather than dec, even though I never used stream formatters. couts in
this program are called from multiple threads, and some couts around
the middle of my program ended up interleaved - couts before it are
fine, and later ones end up in hex. After removing the contentious
couts in the middle, the problem went away - no more hex.

Could this have been an effect of using the streams from multiple
threads? I've been searching a long time for memory bugs, but haven't
come up with anything. Thanks in advance for any hints.
Feb 12 '08 #1
0 1098

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

by: Rasmusson, Lars | last post by:
Hi, I have a problem doing I/O in a python thread. I want a thread to execute a command using os.popen, read its input until the end, and then print 'DONE' and terminate. However, the...
by: Robert Mazur | last post by:
MySQL 5.0 alpha (binary install) on Solaris 9 -or- RedHat 8.0 mysql-connector-java-3.0.8-stable ----------------------- Is there something different going on with JDBC and the alpha version...
by: John | last post by:
I have a Socket open to a target system. I get the network stream from the open socket and then create a stream reader and stream writer on this stream. The stream reader and writers are operating...
by: Michael Shestero | last post by:
Hello. I have some function f(stream* out) that makes text-output into stream (*out) i.e. (*out)<<"Hello"<<endl;. The (*out) can be cout, ofstream, a strstream, etc. This function working in the...
by: andrewcw | last post by:
OK I am half way there - I can manipulate the stream without the byte issue like this - but is this the way to push the new values back into the stream & write out the stream without resorting to...
by: Daniel Corbett | last post by:
I am trying to save a file dynamically created in a webpage. I get the following headers, but cannot figure out how to save the attachment. I am basically trying to replicate what internet...
by: frustrated | last post by:
I am trying to share a file stream between two threads, but havent got a clue as to how to do it. The first thread will be reading the file, and the second thread will(/might) be writing to the...
by: crashed | last post by:
Hi, I am using C# in .NET 2.0 and im trying to read a stream from a socket. The code works on the first attempt but fails on subsequent attempts. It is in a multithreaded application. It seems...
by: John Kraft | last post by:
Hello all, I'm experiencing some, imo, strange behavior with the StreamReader object I am using in the code below. Summary is that I am downloading a file from a website and saving it to disk...
by: carmelo8 | last post by:
Hi there, I want to timeout Read method of System.Stream class after 30 secs. of no activity given a certain opened connection. That is, because some incoming connections to my application just...
by: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.