From 24ba357b0dbd859b9bb9f938dd5d2deda8c295bf Mon Sep 17 00:00:00 2001 From: Eric Frias Date: Sat, 26 Jul 2014 14:51:48 -0400 Subject: [PATCH] Make future's cancel_and_wait automatically swallow the canceled_exception since it is expected. --- include/fc/thread/future.hpp | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/include/fc/thread/future.hpp b/include/fc/thread/future.hpp index 86e8a96..4c0757c 100644 --- a/include/fc/thread/future.hpp +++ b/include/fc/thread/future.hpp @@ -211,7 +211,13 @@ namespace fc { if( valid() ) { cancel(); - wait(); + try + { + wait(); + } + catch (const canceled_exception&) + { + } } } @@ -265,8 +271,14 @@ namespace fc { void cancel_and_wait() { - cancel(); - wait(); + cancel(); + try + { + wait(); + } + catch (const canceled_exception&) + { + } } /// @pre valid()