summaryrefslogtreecommitdiffstats
path: root/host/lib/transport
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/transport
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/transport')
-rw-r--r--host/lib/transport/libusb1_zero_copy.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/host/lib/transport/libusb1_zero_copy.cpp b/host/lib/transport/libusb1_zero_copy.cpp
index 9f38ce97b..fe6936c7e 100644
--- a/host/lib/transport/libusb1_zero_copy.cpp
+++ b/host/lib/transport/libusb1_zero_copy.cpp
@@ -24,6 +24,7 @@
#include <boost/function.hpp>
#include <boost/foreach.hpp>
#include <boost/thread/thread.hpp>
+#include <boost/thread/barrier.hpp>
#include <list>
#include <iostream>
@@ -191,9 +192,11 @@ public:
//spawn the event handler threads
size_t concurrency = hints.cast<size_t>("concurrency_hint", 1);
+ boost::barrier spawn_barrier(concurrency+1);
for (size_t i = 0; i < concurrency; i++) _thread_group.create_thread(
- boost::bind(&libusb_zero_copy_impl::run_event_loop, this)
+ boost::bind(&libusb_zero_copy_impl::run_event_loop, this, boost::ref(spawn_barrier))
);
+ spawn_barrier.wait();
}
~libusb_zero_copy_impl(void){
@@ -263,7 +266,8 @@ private:
boost::thread_group _thread_group;
bool _threads_running;
- void run_event_loop(void){
+ void run_event_loop(boost::barrier &spawn_barrier){
+ spawn_barrier.wait();
set_thread_priority_safe();
libusb_context *context = libusb::session::get_global_session()->get_context();
_threads_running = true;