On Feb 4, 6:17 am, Alex Vinokur <ale...@users.s ourceforge.netw rote:
void foo (int n)
{
std::ostringstr eam 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 objektorientier ter Datenverarbeitu ng
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34