summaryrefslogtreecommitdiffstats
path: root/libcxx/src
diff options
context:
space:
mode:
authorHoward Hinnant <hhinnant@apple.com>2011-07-13 16:00:50 +0000
committerHoward Hinnant <hhinnant@apple.com>2011-07-13 16:00:50 +0000
commit88410049fa8c499e1c4bee3bde4b9da156f730d7 (patch)
treed693526b6716e7db58f93f1c7789597c19a776b0 /libcxx/src
parentf6b7e20bc8b8c8a6759654ed8c31c264c66d31a6 (diff)
downloadbcm5719-llvm-88410049fa8c499e1c4bee3bde4b9da156f730d7.tar.gz
bcm5719-llvm-88410049fa8c499e1c4bee3bde4b9da156f730d7.zip
http://llvm.org/bugs/show_bug.cgi?id=10346
llvm-svn: 135045
Diffstat (limited to 'libcxx/src')
-rw-r--r--libcxx/src/future.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/libcxx/src/future.cpp b/libcxx/src/future.cpp
index 4c3a3fa8b98..ff59110593b 100644
--- a/libcxx/src/future.cpp
+++ b/libcxx/src/future.cpp
@@ -73,8 +73,10 @@ void
__assoc_sub_state::set_value()
{
unique_lock<mutex> __lk(__mut_);
+#ifndef _LIBCPP_NO_EXCEPTIONS
if (__has_value())
throw future_error(make_error_code(future_errc::promise_already_satisfied));
+#endif
__state_ |= __constructed | ready;
__lk.unlock();
__cv_.notify_all();
@@ -84,8 +86,10 @@ void
__assoc_sub_state::set_value_at_thread_exit()
{
unique_lock<mutex> __lk(__mut_);
+#ifndef _LIBCPP_NO_EXCEPTIONS
if (__has_value())
throw future_error(make_error_code(future_errc::promise_already_satisfied));
+#endif
__state_ |= __constructed;
__thread_local_data()->__make_ready_at_thread_exit(this);
__lk.unlock();
@@ -95,8 +99,10 @@ void
__assoc_sub_state::set_exception(exception_ptr __p)
{
unique_lock<mutex> __lk(__mut_);
+#ifndef _LIBCPP_NO_EXCEPTIONS
if (__has_value())
throw future_error(make_error_code(future_errc::promise_already_satisfied));
+#endif
__exception_ = __p;
__state_ |= ready;
__lk.unlock();
@@ -107,8 +113,10 @@ void
__assoc_sub_state::set_exception_at_thread_exit(exception_ptr __p)
{
unique_lock<mutex> __lk(__mut_);
+#ifndef _LIBCPP_NO_EXCEPTIONS
if (__has_value())
throw future_error(make_error_code(future_errc::promise_already_satisfied));
+#endif
__exception_ = __p;
__thread_local_data()->__make_ready_at_thread_exit(this);
__lk.unlock();
@@ -159,14 +167,18 @@ __assoc_sub_state::__sub_wait(unique_lock<mutex>& __lk)
void
__assoc_sub_state::__execute()
{
+#ifndef _LIBCPP_NO_EXCEPTIONS
throw future_error(make_error_code(future_errc::no_state));
+#endif
}
future<void>::future(__assoc_sub_state* __state)
: __state_(__state)
{
+#ifndef _LIBCPP_NO_EXCEPTIONS
if (__state_->__has_future_attached())
throw future_error(make_error_code(future_errc::future_already_retrieved));
+#endif
__state_->__add_shared();
__state_->__set_future_attached();
}
@@ -206,40 +218,50 @@ promise<void>::~promise()
future<void>
promise<void>::get_future()
{
+#ifndef _LIBCPP_NO_EXCEPTIONS
if (__state_ == nullptr)
throw future_error(make_error_code(future_errc::no_state));
+#endif
return future<void>(__state_);
}
void
promise<void>::set_value()
{
+#ifndef _LIBCPP_NO_EXCEPTIONS
if (__state_ == nullptr)
throw future_error(make_error_code(future_errc::no_state));
+#endif
__state_->set_value();
}
void
promise<void>::set_exception(exception_ptr __p)
{
+#ifndef _LIBCPP_NO_EXCEPTIONS
if (__state_ == nullptr)
throw future_error(make_error_code(future_errc::no_state));
+#endif
__state_->set_exception(__p);
}
void
promise<void>::set_value_at_thread_exit()
{
+#ifndef _LIBCPP_NO_EXCEPTIONS
if (__state_ == nullptr)
throw future_error(make_error_code(future_errc::no_state));
+#endif
__state_->set_value_at_thread_exit();
}
void
promise<void>::set_exception_at_thread_exit(exception_ptr __p)
{
+#ifndef _LIBCPP_NO_EXCEPTIONS
if (__state_ == nullptr)
throw future_error(make_error_code(future_errc::no_state));
+#endif
__state_->set_exception_at_thread_exit(__p);
}
OpenPOWER on IntegriCloud