boost::logging::writer::ts_write< base_type > Struct Template Reference

Inheritance diagram for boost::logging::writer::ts_write< base_type >:
[legend]
Collaboration diagram for boost::logging::writer::ts_write< base_type >:
[legend]

List of all members.


Detailed Description

template<class base_type>
struct boost::logging::writer::ts_write< base_type >

#include <boost/logging/format.hpp>

Performs all writes in a thread-safe manner. In other words, makes sure that all operator() calls of base_type are called in a thread-safe manner.

To transform a writer into thread-safe writer, simply surround the writer with ts_write:

Example:

// not thread-safe
logger< gather::ostream_like::return_str<>, write_to_cout> g_l();

// thread-safe
logger< gather::ostream_like::return_str<>, ts_write<write_to_cout> > g_l();


// not thread-safe
logger< 
    gather::ostream_like::return_cache_str<> , 
    format_write< format_base, destination_base> > g_l();

// thread-safe
logger< 
    gather::ostream_like::return_cache_str<> , 
    ts_write< format_write< format_base, destination_base > > > g_l();

Depending on your scenario, you could prefer on_dedicated_thread class.

See also:
on_dedicated_thread

The documentation for this struct was generated from the following file:

Copyright John Torjo © 2007
Have a question/ suggestion/ comment? Send me feedback