summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '3rdParty/Boost/src/boost/thread/future.hpp')
-rw-r--r--3rdParty/Boost/src/boost/thread/future.hpp56
1 files changed, 29 insertions, 27 deletions
diff --git a/3rdParty/Boost/src/boost/thread/future.hpp b/3rdParty/Boost/src/boost/thread/future.hpp
index 3d694eb..8111d9e 100644
--- a/3rdParty/Boost/src/boost/thread/future.hpp
+++ b/3rdParty/Boost/src/boost/thread/future.hpp
@@ -1,4 +1,4 @@
-// (C) Copyright 2008-9 Anthony Williams
+// (C) Copyright 2008-10 Anthony Williams
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
@@ -16,6 +16,7 @@
#include <boost/type_traits/is_convertible.hpp>
#include <boost/mpl/if.hpp>
#include <boost/config.hpp>
+#include <boost/throw_exception.hpp>
#include <algorithm>
#include <boost/function.hpp>
#include <boost/bind.hpp>
@@ -218,7 +219,7 @@ namespace boost
struct future_traits
{
typedef boost::scoped_ptr<T> storage_type;
-#ifdef BOOST_HAS_RVALUE_REFS
+#ifndef BOOST_NO_RVALUE_REFERENCES
typedef T const& source_reference_type;
struct dummy;
typedef typename boost::mpl::if_<boost::is_fundamental<T>,dummy&,T&&>::type rvalue_source_type;
@@ -323,7 +324,7 @@ namespace boost
move_dest_type get()
{
wait();
- return *result;
+ return static_cast<move_dest_type>(*result);
}
future_state::state get_state()
@@ -403,13 +404,14 @@ namespace boost
struct all_futures_lock
{
- unsigned count;
+ typedef std::vector<registered_waiter>::size_type count_type;
+ count_type count;
boost::scoped_array<boost::unique_lock<boost::mutex> > locks;
all_futures_lock(std::vector<registered_waiter>& futures):
count(futures.size()),locks(new boost::unique_lock<boost::mutex>[count])
{
- for(unsigned i=0;i<count;++i)
+ for(count_type i=0;i<count;++i)
{
locks[i]=boost::unique_lock<boost::mutex>(futures[i].future->mutex);
}
@@ -632,7 +634,7 @@ namespace boost
~unique_future()
{}
-#ifdef BOOST_HAS_RVALUE_REFS
+#ifndef BOOST_NO_RVALUE_REFERENCES
unique_future(unique_future && other)
{
future.swap(other.future);
@@ -673,7 +675,7 @@ namespace boost
{
if(!future)
{
- throw future_uninitialized();
+ boost::throw_exception(future_uninitialized());
}
return future->get();
@@ -709,7 +711,7 @@ namespace boost
{
if(!future)
{
- throw future_uninitialized();
+ boost::throw_exception(future_uninitialized());
}
future->wait(false);
}
@@ -724,7 +726,7 @@ namespace boost
{
if(!future)
{
- throw future_uninitialized();
+ boost::throw_exception(future_uninitialized());
}
return future->timed_wait_until(abs_time);
}
@@ -767,7 +769,7 @@ namespace boost
future=other.future;
return *this;
}
-#ifdef BOOST_HAS_RVALUE_REFS
+#ifndef BOOST_NO_RVALUE_REFERENCES
shared_future(shared_future && other)
{
future.swap(other.future);
@@ -830,7 +832,7 @@ namespace boost
{
if(!future)
{
- throw future_uninitialized();
+ boost::throw_exception(future_uninitialized());
}
return future->get();
@@ -866,7 +868,7 @@ namespace boost
{
if(!future)
{
- throw future_uninitialized();
+ boost::throw_exception(future_uninitialized());
}
future->wait(false);
}
@@ -881,7 +883,7 @@ namespace boost
{
if(!future)
{
- throw future_uninitialized();
+ boost::throw_exception(future_uninitialized());
}
return future->timed_wait_until(abs_time);
}
@@ -929,7 +931,7 @@ namespace boost
}
// Assignment
-#ifdef BOOST_HAS_RVALUE_REFS
+#ifndef BOOST_NO_RVALUE_REFERENCES
promise(promise && rhs):
future_obtained(rhs.future_obtained)
{
@@ -974,7 +976,7 @@ namespace boost
lazy_init();
if(future_obtained)
{
- throw future_already_retrieved();
+ boost::throw_exception(future_already_retrieved());
}
future_obtained=true;
return unique_future<R>(future);
@@ -986,7 +988,7 @@ namespace boost
boost::lock_guard<boost::mutex> lock(future->mutex);
if(future->done)
{
- throw promise_already_satisfied();
+ boost::throw_exception(promise_already_satisfied());
}
future->mark_finished_with_result_internal(r);
}
@@ -998,7 +1000,7 @@ namespace boost
boost::lock_guard<boost::mutex> lock(future->mutex);
if(future->done)
{
- throw promise_already_satisfied();
+ boost::throw_exception(promise_already_satisfied());
}
future->mark_finished_with_result_internal(static_cast<typename detail::future_traits<R>::rvalue_source_type>(r));
}
@@ -1009,7 +1011,7 @@ namespace boost
boost::lock_guard<boost::mutex> lock(future->mutex);
if(future->done)
{
- throw promise_already_satisfied();
+ boost::throw_exception(promise_already_satisfied());
}
future->mark_exceptional_finish_internal(p);
}
@@ -1063,7 +1065,7 @@ namespace boost
}
// Assignment
-#ifdef BOOST_HAS_RVALUE_REFS
+#ifndef BOOST_NO_RVALUE_REFERENCES
promise(promise && rhs):
future_obtained(rhs.future_obtained)
{
@@ -1109,7 +1111,7 @@ namespace boost
if(future_obtained)
{
- throw future_already_retrieved();
+ boost::throw_exception(future_already_retrieved());
}
future_obtained=true;
return unique_future<void>(future);
@@ -1121,7 +1123,7 @@ namespace boost
boost::lock_guard<boost::mutex> lock(future->mutex);
if(future->done)
{
- throw promise_already_satisfied();
+ boost::throw_exception(promise_already_satisfied());
}
future->mark_finished_with_result_internal();
}
@@ -1132,7 +1134,7 @@ namespace boost
boost::lock_guard<boost::mutex> lock(future->mutex);
if(future->done)
{
- throw promise_already_satisfied();
+ boost::throw_exception(promise_already_satisfied());
}
future->mark_exceptional_finish_internal(p);
}
@@ -1164,7 +1166,7 @@ namespace boost
boost::lock_guard<boost::mutex> lk(this->mutex);
if(started)
{
- throw task_already_started();
+ boost::throw_exception(task_already_started());
}
started=true;
}
@@ -1283,7 +1285,7 @@ namespace boost
}
// assignment
-#ifdef BOOST_HAS_RVALUE_REFS
+#ifndef BOOST_NO_RVALUE_REFERENCES
packaged_task(packaged_task&& other):
future_obtained(other.future_obtained)
{
@@ -1326,7 +1328,7 @@ namespace boost
{
if(!task)
{
- throw task_moved();
+ boost::throw_exception(task_moved());
}
else if(!future_obtained)
{
@@ -1335,7 +1337,7 @@ namespace boost
}
else
{
- throw future_already_retrieved();
+ boost::throw_exception(future_already_retrieved());
}
}
@@ -1345,7 +1347,7 @@ namespace boost
{
if(!task)
{
- throw task_moved();
+ boost::throw_exception(task_moved());
}
task->run();
}