Using Boost 1.43, this program:
# include
int main()
{
boost::shared_mutex mutex;
boost::upgrade_lockboost::shared_mutex lock(mutex);
boost::upgrade_to_unique_lockboost::shared_mutex write_lock(lock);
}
... produces this error when compiled with Visual C++ 2010:
C:\Users\braden>cl /I include/boost-1_43 /MD /EHsc upgrade_to_unique_lock_test.cpp
Microsoft (R) C/C++ Optimizing Compiler Version 16.00.30319.01 for x64
Copyright (C) Microsoft Corporation. All rights reserved.
upgrade_to_unique_lock_test.cpp
include/boost-1_43\boost/thread/locks.hpp(823) : error C2679: binary '=' : no operator found which takes a right-hand operand of type 'boost::unique_lock<Mutex>' (or there is no acceptable conversion)
with
[
Mutex=boost::shared_mutex
]
include/boost-1_43\boost/thread/locks.hpp(659): could be 'boost::upgrade_lock<Mutex> &boost::upgrade_lock<Mutex>::operator =(boost::upgrade_lock<Mutex>&)'
with
[
Mutex=boost::shared_mutex
]
include/boost-1_43\boost/thread/locks.hpp(710): or 'boost::upgrade_lock<Mutex> &boost::upgrade_lock<Mutex>::operator =(boost::detail::thread_move_t<T>)'
with
[
Mutex=boost::shared_mutex,
T=boost::upgrade_lockboost::shared_mutex
]
include/boost-1_43\boost/thread/locks.hpp(717): or 'boost::upgrade_lock<Mutex> &boost::upgrade_lock<Mutex>::operator =(boost::detail::thread_move_t<T>)'
with
[
Mutex=boost::shared_mutex,
T=boost::unique_lockboost::shared_mutex
]
while trying to match the argument list '(boost::upgrade_lock<Mutex>, boost::unique_lock<Mutex>)'
with
[
Mutex=boost::shared_mutex
]
include/boost-1_43\boost/thread/locks.hpp(820) : while compiling class template member function 'boost::upgrade_to_unique_lock<Mutex>::~upgrade_to_unique_lock(void)'
with
[
Mutex=boost::shared_mutex
]
upgrade_to_unique_lock_test.cpp(7) : see reference to class template instantiation 'boost::upgrade_to_unique_lock<Mutex>' being compiled
with
[
Mutex=boost::shared_mutex
]
I've searched a bit for previous reports of this sort of thing and I
haven't found any. Hopefully that means I'm just doing something wrong.
--
Braden McDaniel