From c0764b44e3f38fe954474ccdf92895b943d8d889 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Mon, 25 Jul 2011 18:22:18 -0700 Subject: uhd: exit task on the catch-all exceptions, and dont print anything --- host/lib/utils/tasks.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'host/lib/utils') diff --git a/host/lib/utils/tasks.cpp b/host/lib/utils/tasks.cpp index ef56bb2de..993b484ea 100644 --- a/host/lib/utils/tasks.cpp +++ b/host/lib/utils/tasks.cpp @@ -34,6 +34,7 @@ public: } ~task_impl(void){ + _running = false; _thread_group.interrupt_all(); _thread_group.join_all(); } @@ -41,10 +42,11 @@ public: private: void task_loop(const task_fcn_type &task_fcn, boost::barrier &spawn_barrier){ + _running = true; spawn_barrier.wait(); try{ - while (not boost::this_thread::interruption_requested()){ + while (_running){ task_fcn(); } } @@ -55,7 +57,9 @@ private: do_error_msg(e.what()); } catch(...){ - do_error_msg("unknown exception"); + //FIXME + //Unfortunately, this is also an ok way to end a task, + //because on some systems boost throws uncatchables. } } @@ -68,6 +72,7 @@ private: } boost::thread_group _thread_group; + bool _running; }; task::sptr task::make(const task_fcn_type &task_fcn){ -- cgit v1.2.3