thread_safe< T >

Experimental - A thread-safe object wrapper. More...

`#include <thread_safe.hpp>`

Inherits pn_ptr_base, and endpoint_traits< T >.

## Public Member Functions

class event_loop * | event_loop ()
| Get the event loop for this object.
T | unsafe ()
| Get the thread-unsafe proton object wrapped by this thread_safe<T>

## Detailed Description

### template<class T>
class proton::thread_safe< T >

Experimental - A thread-safe object wrapper.

The proton::object subclasses (proton::connection, proton::sender etc.) are reference-counted wrappers for C structs. They are not safe for concurrent use, not even to copy or assign.

A pointer to thread_safe<> can be used from any thread to get the proton::event_loop for the object's connection. The object will not be destroyed until the thread_safe<> is deleted. You can use std::shared_ptr, std::unique_ptr or any other memory management technique to manage the thread_safe<>.

Use make_thread_safe(), make_shared_thread_safe(), make_unique_thread_safe() to create a thread_safe<>

See also
  Multithreaded Proton applications

The documentation for this class was generated from the following files:

- proton/connection.hpp
- proton/thread_safe.hpp