diff options
| author | Josh Blum <josh@joshknows.com> | 2011-07-25 18:22:18 -0700 | 
|---|---|---|
| committer | Josh Blum <josh@joshknows.com> | 2011-07-25 18:22:18 -0700 | 
| commit | c0764b44e3f38fe954474ccdf92895b943d8d889 (patch) | |
| tree | ab5757d78045cda237c22baffcd140de06045070 /host/lib/utils | |
| parent | ddbada4e64fe4117a0777b7a3d12a1a527991511 (diff) | |
| download | uhd-c0764b44e3f38fe954474ccdf92895b943d8d889.tar.gz uhd-c0764b44e3f38fe954474ccdf92895b943d8d889.tar.bz2 uhd-c0764b44e3f38fe954474ccdf92895b943d8d889.zip  | |
uhd: exit task on the catch-all exceptions, and dont print anything
Diffstat (limited to 'host/lib/utils')
| -rw-r--r-- | host/lib/utils/tasks.cpp | 9 | 
1 files changed, 7 insertions, 2 deletions
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){  | 
