Hi all,

Anyone interested in thread-safe access to std::basic_ostream<>s?

The idea is that you write like the way you're used to, and when the stream
is flushed, thread-safety happens behind the scenes, very much like:

{
// 100 locks, after each written std::endl
for( int idx = 0; idx < 100; ++idx)
   get_log() << "message " << idx << " to log." << std::endl;
}


{
// 1 lock, after all messages have been written
thread_safe_log log = get_log();
for( int idx = 0; idx < 100; ++idx)
   log << "message " << idx << " to log.\n";
log.flush();
}

I will write a more detailed description soon.


Best,
John

--
John Torjo
-- "Practical C++" column writer for builder.com.com

Freelancer, C++ consultant
mailto:[EMAIL PROTECTED]


_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Reply via email to