aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-08-07 16:04:25 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-08-07 16:04:25 +0000
commit59f44a2a6d6af235455bc133dcdad6afa7ffb762 (patch)
tree366ea67323dbef29346058a70fb89fc908316e9e
parentc835eb63e1052bf0bdaf4c2c14f778e3be514659 (diff)
downloadpaludis-59f44a2a6d6af235455bc133dcdad6afa7ffb762.tar.gz
paludis-59f44a2a6d6af235455bc133dcdad6afa7ffb762.tar.xz
Handle exceptions inside futures
-rw-r--r--paludis/util/future-impl.hh17
1 files changed, 12 insertions, 5 deletions
diff --git a/paludis/util/future-impl.hh b/paludis/util/future-impl.hh
index fa59f65..52b97e4 100644
--- a/paludis/util/future-impl.hh
+++ b/paludis/util/future-impl.hh
@@ -95,12 +95,19 @@ void paludis::adapt_for_future(
tr1::shared_ptr<Mutex> mutex,
tr1::shared_ptr<ConditionVariable> condition)
{
- TryLock l(*mutex);
- if (l())
+ try
{
- if (! *result)
- result->reset(new T_(f()));
- condition->broadcast();
+ TryLock l(*mutex);
+ if (l())
+ {
+ if (! *result)
+ result->reset(new T_(f()));
+ condition->broadcast();
+ }
+ }
+ catch (...)
+ {
+ // exception will be raised when operator() is called
}
}