Documentation Home >> Headers >> <jss/synchronized_value.hpp> Header >> jss::synchronized_value class template

jss::synchronized_value<> wraps an object along with a mutex to ensure that only one thread can access the wrapped object at a time. The wrapped object can be accessed through the pointer dereference and member access operators, or through an instance of the jss::update_guard class template. All such accesses are done with the internal mutex locked.

namespace jss
{
    template<typename T>
    class synchronized_value
    {
    public:
        synchronized_value(synchronized_value const&) = delete;
        synchronized_value& operator=(synchronized_value const&) = delete;

        template<typename ... Args>
        synchronized_value(Args&& ... args);
        ~synchronized_value();

        unspecified operator->();
        unspecified operator*();
    };
}
Header

#include <jss/synchronized_value.hpp>

See Also