summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2011-07-26 11:15:04 -0700
committerJosh Blum <josh@joshknows.com>2011-07-26 11:15:04 -0700
commit1e9ff6fb0e946c8984f48fcf2ef868fb86dec5ea (patch)
tree989020a4195340520a0dd0fe370e8d00bbfd8ae7
parent0e6441c3e0922642a69607b285521077a2a2f3b9 (diff)
downloaduhd-1e9ff6fb0e946c8984f48fcf2ef868fb86dec5ea.tar.gz
uhd-1e9ff6fb0e946c8984f48fcf2ef868fb86dec5ea.tar.bz2
uhd-1e9ff6fb0e946c8984f48fcf2ef868fb86dec5ea.zip
uhd: make spawn barrier a member of a task (see notes)
On OSX w/ boost 1.47, this general area of code was inconsistently barfing w/ lock error. Perhaps its a boost bug, in any case, using it this way seems to solve the problem.
-rw-r--r--host/lib/utils/tasks.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/host/lib/utils/tasks.cpp b/host/lib/utils/tasks.cpp
index 993b484ea..1f735de06 100644
--- a/host/lib/utils/tasks.cpp
+++ b/host/lib/utils/tasks.cpp
@@ -27,10 +27,11 @@ using namespace uhd;
class task_impl : public task{
public:
- task_impl(const task_fcn_type &task_fcn){
- boost::barrier spawn_barrier(2);
- _thread_group.create_thread(boost::bind(&task_impl::task_loop, this, task_fcn, boost::ref(spawn_barrier)));
- spawn_barrier.wait();
+ task_impl(const task_fcn_type &task_fcn):
+ _spawn_barrier(2)
+ {
+ _thread_group.create_thread(boost::bind(&task_impl::task_loop, this, task_fcn));
+ _spawn_barrier.wait();
}
~task_impl(void){
@@ -41,9 +42,9 @@ public:
private:
- void task_loop(const task_fcn_type &task_fcn, boost::barrier &spawn_barrier){
+ void task_loop(const task_fcn_type &task_fcn){
_running = true;
- spawn_barrier.wait();
+ _spawn_barrier.wait();
try{
while (_running){
@@ -72,6 +73,7 @@ private:
}
boost::thread_group _thread_group;
+ boost::barrier _spawn_barrier;
bool _running;
};