|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r81680 - in trunk: boost/thread libs/thread/example
From: vicente.botet_at_[hidden]
Date: 2012-12-02 16:30:40
Author: viboes
Date: 2012-12-02 16:30:39 EST (Sun, 02 Dec 2012)
New Revision: 81680
URL: http://svn.boost.org/trac/boost/changeset/81680
Log:
Thread: fix strinct_synchronizer move error and update the example to be run on all compilers.
Text files modified:
trunk/boost/thread/synchronized_value.hpp | 3 ++-
trunk/libs/thread/example/synchronized_person.cpp | 28 +++++++++++-----------------
trunk/libs/thread/example/synchronized_value.cpp | 14 +-------------
3 files changed, 14 insertions(+), 31 deletions(-)
Modified: trunk/boost/thread/synchronized_value.hpp
==============================================================================
--- trunk/boost/thread/synchronized_value.hpp (original)
+++ trunk/boost/thread/synchronized_value.hpp 2012-12-02 16:30:39 EST (Sun, 02 Dec 2012)
@@ -97,6 +97,7 @@
*
* Return: *this
*/
+
synchronized_value& operator=(synchronized_value const& rhs)
{
if(&rhs != this)
@@ -236,7 +237,7 @@
BOOST_THREAD_MOVABLE_ONLY( strict_synchronizer )
strict_synchronizer(BOOST_THREAD_RV_REF(strict_synchronizer) other)
- : const_strict_synchronizer(boost::move(other))
+ : const_strict_synchronizer(boost::move(static_cast<const_strict_synchronizer&>(other)))
{
}
Modified: trunk/libs/thread/example/synchronized_person.cpp
==============================================================================
--- trunk/libs/thread/example/synchronized_person.cpp (original)
+++ trunk/libs/thread/example/synchronized_person.cpp 2012-12-02 16:30:39 EST (Sun, 02 Dec 2012)
@@ -3,18 +3,12 @@
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
-//#define BOOST_THREAD_VERSION 4
-
-// There is yet a limitation when BOOST_THREAD_PROVIDES_FUTURE_INVALID_AFTER_GET is defined
-#define BOOST_THREAD_DONT_PROVIDE_FUTURE_INVALID_AFTER_GET
+#define BOOST_THREAD_VERSION 4
#include <iostream>
#include <string>
#include <boost/thread/synchronized_value.hpp>
-#if ! defined BOOST_NO_CXX11_RVALUE_REFERENCES && ! defined BOOST_NO_CXX11_AUTO
-
-
//class SafePerson {
//public:
// std::string GetName() const {
@@ -161,12 +155,20 @@
member(age)
{ }
std::string GetName() const {
- auto&& memberSync = member.synchronize();
+#if ! defined BOOST_NO_CXX11_AUTO_DECLARATIONS
+ auto memberSync = member.synchronize();
+#else
+ boost::synchronized_value<Member>::const_strict_synchronizer memberSync = member.synchronize();
+#endif
Invariant(memberSync);
return memberSync->name;
}
void SetName(const std::string& newName) {
- auto&& memberSync = member.synchronize();
+#if ! defined BOOST_NO_CXX11_AUTO_DECLARATIONS
+ auto memberSync = member.synchronize();
+#else
+ boost::synchronized_value<Member>::strict_synchronizer memberSync = member.synchronize();
+#endif
Invariant(memberSync);
memberSync->name = newName;
}
@@ -236,11 +238,3 @@
}
return 0;
}
-
-#else
-
-int main()
-{
- return 0;
-}
-#endif
Modified: trunk/libs/thread/example/synchronized_value.cpp
==============================================================================
--- trunk/libs/thread/example/synchronized_value.cpp (original)
+++ trunk/libs/thread/example/synchronized_value.cpp 2012-12-02 16:30:39 EST (Sun, 02 Dec 2012)
@@ -4,17 +4,12 @@
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
-//#define BOOST_THREAD_VERSION 4
-
-// There is yet a limitation when BOOST_THREAD_PROVIDES_FUTURE_INVALID_AFTER_GET is defined
-#define BOOST_THREAD_DONT_PROVIDE_FUTURE_INVALID_AFTER_GET
+#define BOOST_THREAD_VERSION 4
#include <iostream>
#include <string>
#include <boost/thread/synchronized_value.hpp>
-#if ! defined BOOST_NO_CXX11_RVALUE_REFERENCES
-
void addTrailingSlashIfMissing(boost::synchronized_value<std::string> & path)
{
boost::synchronized_value<std::string>::strict_synchronizer u=path.synchronize();
@@ -88,10 +83,3 @@
return 0;
}
-#else
-
-int main()
-{
- return 0;
-}
-#endif
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk