aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2010-09-26 20:54:58 -0700
committerJosh Blum <josh@joshknows.com>2010-09-26 20:54:58 -0700
commit86213f8de2cc4ca671f9afbcf475c744fe7aebcb (patch)
treeee905defd3369f1cb9d8fdb01aa81e7629fce99e
parent0816925695aa69a1ae344863fef47d239b3ec8af (diff)
downloaduhd-86213f8de2cc4ca671f9afbcf475c744fe7aebcb.tar.gz
uhd-86213f8de2cc4ca671f9afbcf475c744fe7aebcb.tar.bz2
uhd-86213f8de2cc4ca671f9afbcf475c744fe7aebcb.zip
usb: disable thread interruption on wait calls
-rw-r--r--host/lib/transport/libusb1_zero_copy.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/host/lib/transport/libusb1_zero_copy.cpp b/host/lib/transport/libusb1_zero_copy.cpp
index e84793e88..d3888240b 100644
--- a/host/lib/transport/libusb1_zero_copy.cpp
+++ b/host/lib/transport/libusb1_zero_copy.cpp
@@ -21,6 +21,7 @@
#include <uhd/utils/assert.hpp>
#include <boost/shared_array.hpp>
#include <boost/foreach.hpp>
+#include <boost/thread.hpp>
#include <vector>
#include <iostream>
#include <iomanip>
@@ -132,6 +133,7 @@ static void callback(libusb_transfer *lut){
* \param pointer to libusb_transfer
*/
void usb_endpoint::callback_handle_transfer(libusb_transfer *lut){
+ boost::this_thread::disable_interruption di; //disable because the wait can throw
_completed_list->push_with_wait(lut);
}
@@ -182,10 +184,7 @@ usb_endpoint::~usb_endpoint(void){
}
//collect canceled transfers (drain the queue)
- libusb_transfer *lut;
- while(_completed_list->pop_with_timed_wait(
- lut, boost::posix_time::milliseconds(100)
- ));
+ while (this->get_lut_with_wait() != NULL);
//free all transfers
BOOST_FOREACH(libusb_transfer *lut, _all_luts){
@@ -273,6 +272,7 @@ void usb_endpoint::print_transfer_status(libusb_transfer *lut){
}
libusb_transfer *usb_endpoint::get_lut_with_wait(size_t timeout_ms){
+ boost::this_thread::disable_interruption di; //disable because the wait can throw
libusb_transfer *lut;
if (_completed_list->pop_with_timed_wait(
lut, boost::posix_time::milliseconds(timeout_ms)