У меня есть небольшие cpp source и h source файлы с некоторым классом. Он использует общие мьютексы и общие блокировки . Компилируется на Windows без ошибок с Boost 1.48.0. Он также скомпилирован на Linux (с бустом 1.47 до). Но теперь, имея такой код:
boost::shared_mutex mut_;
//...
boost::upgrade_lock<boost::shared_mutex> lock(mut_);
boost::upgrade_to_unique_lock<boost::shared_mutex> uniqueLock(lock);
приводит к странным ошибкам:
==== Building cf-fs (debug) ====
Creating bin/obj/Debug/cf-fs
fs_concurrent_queued_map.cpp
fs_map.cpp
In file included from ../../src/cf-util/http_utils_inl.h:1,
from ../../src/cf-util/http_utils.h:104,
from ../../src/cf-fs/fs_map.h:13,
from ../../src/cf-fs/fs_map.cpp:1:
../../src/cf-util/http_utils.h:105:8: warning: extra tokens at end of #endif directive
In file included from ../../src/cf-fs/fs_map.h:13,
from ../../src/cf-fs/fs_map.cpp:1:
../../src/cf-util/http_utils.h:105:8: warning: extra tokens at end of #endif directive
In file included from ../../../boost_libraries/install-dir/include/boost/thread/pthread/mutex.hpp:12,
from ../../../boost_libraries/install-dir/include/boost/thread/mutex.hpp:16,
from ../../../boost_libraries/install-dir/include/boost/thread/pthread/thread_data.hpp:12,
from ../../../boost_libraries/install-dir/include/boost/thread/thread.hpp:17,
from ../../../boost_libraries/install-dir/include/boost/thread.hpp:13,
from ../../src/cf-fs/fs_map.h:10,
from ../../src/cf-fs/fs_map.cpp:1:
../../../boost_libraries/install-dir/include/boost/thread/locks.hpp: In constructor ‘boost::upgrade_to_unique_lock<Mutex>::upgrade_to_unique_lock(boost::upgrade_lock<Mutex>&) [with Mutex = boost::shared_mutex]’:
../../src/cf-fs/fs_map.cpp:33: instantiated from here
../../../boost_libraries/install-dir/include/boost/thread/locks.hpp:926: error: call of overloaded ‘move(boost::upgrade_lock<boost::shared_mutex>&)’ is ambiguous
../../../boost_libraries/install-dir/include/boost/thread/detail/move.hpp:44: note: candidates are: typename boost::enable_if<boost::is_convertible<T&, boost::detail::thread_move_t<T> >, boost::detail::thread_move_t<T> >::type boost::move(T&) [with T = boost::upgrade_lock<boost::shared_mutex>]
../../../boost_libraries/install-dir/include/boost/move/move.hpp:294: note: typename boost::move_detail::disable_if<boost::has_move_emulation_enabled<T>, T&>::type boost::move(T&) [with T = boost::upgrade_lock<boost::shared_mutex>]
../../../boost_libraries/install-dir/include/boost/thread/locks.hpp: In destructor ‘boost::upgrade_to_unique_lock<Mutex>::~upgrade_to_unique_lock() [with Mutex = boost::shared_mutex]’:
../../src/cf-fs/fs_map.cpp:33: instantiated from here
../../../boost_libraries/install-dir/include/boost/thread/locks.hpp:932: error: call of overloaded ‘move(boost::unique_lock<boost::shared_mutex>&)’ is ambiguous
../../../boost_libraries/install-dir/include/boost/thread/detail/move.hpp:44: note: candidates are: typename boost::enable_if<boost::is_convertible<T&, boost::detail::thread_move_t<T> >, boost::detail::thread_move_t<T> >::type boost::move(T&) [with T = boost::unique_lock<boost::shared_mutex>]
../../../boost_libraries/install-dir/include/boost/move/move.hpp:294: note: typename boost::move_detail::disable_if<boost::has_move_emulation_enabled<T>, T&>::type boost::move(T&) [with T = boost::unique_lock<boost::shared_mutex>]
make[1]: *** [bin/obj/Debug/cf-fs/fs_map.o] Ошибка 1
make: *** [cf-fs] Ошибка 2
Есть ли у меня что-то не так в моем коде, который не должен компилироваться, и как это исправить или обойти это?