|
Boost : |
From: John Torjo (john_at_[hidden])
Date: 2003-04-02 02:11:04
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:john_at_[hidden]
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk