summaryrefslogtreecommitdiffstats
path: root/host/lib/usrp/usrp1
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2011-04-01 10:40:21 -0700
committerJosh Blum <josh@joshknows.com>2011-04-01 10:40:21 -0700
commitbaaa2c55e73f7476ffcd47a2c3ced5edbfeb6f84 (patch)
treeb53a6f43d04d155a5593b3dcdc65ed73f6d125f5 /host/lib/usrp/usrp1
parentdaf91c0a8877909a7100c2ed0274ef3002de0725 (diff)
parent1c5076ea68345e74de35cad43e4a4b4adf68fa15 (diff)
downloaduhd-baaa2c55e73f7476ffcd47a2c3ced5edbfeb6f84.tar.gz
uhd-baaa2c55e73f7476ffcd47a2c3ced5edbfeb6f84.tar.bz2
uhd-baaa2c55e73f7476ffcd47a2c3ced5edbfeb6f84.zip
Merge branch 'use_boost_barrier'
Diffstat (limited to 'host/lib/usrp/usrp1')
-rw-r--r--host/lib/usrp/usrp1/soft_time_ctrl.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/host/lib/usrp/usrp1/soft_time_ctrl.cpp b/host/lib/usrp/usrp1/soft_time_ctrl.cpp
index e1b671811..1bab34e7b 100644
--- a/host/lib/usrp/usrp1/soft_time_ctrl.cpp
+++ b/host/lib/usrp/usrp1/soft_time_ctrl.cpp
@@ -19,6 +19,7 @@
#include <uhd/transport/bounded_buffer.hpp>
#include <boost/any.hpp>
#include <boost/thread/thread.hpp>
+#include <boost/thread/barrier.hpp>
#include <boost/thread/condition_variable.hpp>
#include <boost/date_time/posix_time/posix_time.hpp>
#include <iostream>
@@ -43,10 +44,11 @@ public:
_stream_on_off(stream_on_off)
{
//synchronously spawn a new thread
- _update_mutex.lock(); //lock mutex before spawned
- _thread_group.create_thread(boost::bind(&soft_time_ctrl_impl::recv_cmd_dispatcher, this));
- _update_mutex.lock(); //lock blocks until spawned
- _update_mutex.unlock(); //unlock mutex before done
+ boost::barrier spawn_barrier(2);
+ _thread_group.create_thread(boost::bind(
+ &soft_time_ctrl_impl::recv_cmd_dispatcher, this, boost::ref(spawn_barrier))
+ );
+ spawn_barrier.wait();
//initialize the time to something
this->set_time(time_spec_t(0.0));
@@ -175,8 +177,8 @@ public:
_stream_mode = cmd.stream_mode;
}
- void recv_cmd_dispatcher(void){
- _update_mutex.unlock();
+ void recv_cmd_dispatcher(boost::barrier &spawn_barrier){
+ spawn_barrier.wait();
try{
boost::any cmd;
while (true){