Subject: Re: [Boost-bugs] [Boost C++ Libraries] #10128: Use lockable_adapter with const objects or const members
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2014-06-17 16:34:48
#10128: Use lockable_adapter with const objects or const members
-------------------------------+----------------------
Reporter: anonymous | Owner: viboes
Type: Feature Requests | Status: assigned
Milestone: To Be Determined | Component: thread
Version: Boost 1.54.0 | Severity: Problem
Resolution: | Keywords:
-------------------------------+----------------------
Comment (by viboes):
The error I'm seen is
{{{
test_10128.cpp: In function âint func(const Class1&)â:
test_10128.cpp:29:40: erreur: no matching function for call to
âboost::unique_lock<Class1>::unique_lock(const Class1&)â
boost::unique_lock<Class1> lock(obj);
}}}
A unique_lock<Class1> doesn't accepts a const& Class1 reference.
You wold need to use
{{{
boost::unique_lock<const Class1> lock(obj);
}}}
And this patch
{{{
--- a/include/boost/thread/lockable_adapter.hpp
+++ b/include/boost/thread/lockable_adapter.hpp
@@ -37,11 +37,11 @@ namespace boost
basic_lockable_adapter()
{}
- void lock()
+ void lock() const
{
lockable().lock();
}
- void unlock()
+ void unlock() const
{
lockable().unlock();
}
}}}
Please, could you tell me if this work for you?
^
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/10128#comment:2> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:16 UTC