Boost C++ Libraries of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of Boost. Click here to view this page for the latest version.

Class current_thread_id

boost::log::attributes::current_thread_id — A class of an attribute that always returns the current thread identifier.


// In header: <boost/log/attributes/current_thread_id.hpp>

class current_thread_id : public attribute {
  // types
  typedef thread_id value_type;  // A held attribute value type. 

  // member classes/structs/unions

  // Factory implementation.

  class impl : public attribute_value::impl {

    // public member functions
    virtual bool dispatch(type_dispatcher &);
    virtual intrusive_ptr< attribute_value::impl > detach_from_thread();
    virtual typeindex::type_index get_type() const;

  // construct/copy/destruct
  explicit current_thread_id(cast_source const &);


[Note] Note

This attribute can be registered globally, it will still return the correct thread identifier, no matter which thread emits the log record.

current_thread_id public construct/copy/destruct

  1. current_thread_id();

    Default constructor

  2. explicit current_thread_id(cast_source const & source);

    Constructor for casting support