From 73e87bc599f5038825e8d14a4ab54af0f349e30d Mon Sep 17 00:00:00 2001 From: Oliver Kowalke Date: Sat, 28 Sep 2013 08:20:59 +0200 Subject: [PATCH] fix bug related to fiber::join() --- src/fiber.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/fiber.cpp b/src/fiber.cpp index 05856acf..f7f4243c 100644 --- a/src/fiber.cpp +++ b/src/fiber.cpp @@ -59,11 +59,14 @@ fiber::join() system::errc::invalid_argument, "boost fiber: fiber not joinable") ); } - ptr_t impl_old; - // reset impl_ now, BEFORE calling join(), so it's reset even if join() - // throws - impl_old.swap(impl_); - detail::scheduler::instance()->join(impl_old); + try + { detail::scheduler::instance()->join( impl_); } + catch (...) + { + impl_.reset(); + throw; + } + impl_.reset(); } void