On Feb 4, 6:17 am, Alex Vinokur <ale...@users.sourceforge.netwrote:
void foo (int n)
{
std::ostringstream oss;
oss << "ABCD: " << n << std::endl;
std::cout << oss.str() << std::flush;
}
That function has been invoked in multiprocessing mode.
Output was something like:
ABCA: B1
C
etc.
Is cout << msg an atomic action?
It depends on the implementation, but I would not normally
expect to be able to write to the same stream from two different
threads without some external synchronization. Both reading
from and writing to an iostream modify the object itself.
--
James Kanze (GABI Software) email:ja*********@gmail.com
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34