diff options
Diffstat (limited to 'host')
-rw-r--r-- | host/lib/transport/libusb1_zero_copy.cpp | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/host/lib/transport/libusb1_zero_copy.cpp b/host/lib/transport/libusb1_zero_copy.cpp index 28bff9709..0e6cf94f5 100644 --- a/host/lib/transport/libusb1_zero_copy.cpp +++ b/host/lib/transport/libusb1_zero_copy.cpp @@ -1,5 +1,5 @@ // -// Copyright 2010-2012 Ettus Research LLC +// Copyright 2010-2013 Ettus Research LLC // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -43,7 +43,8 @@ static const size_t DEFAULT_XFER_SIZE = 32*512; //bytes //! helper function: handles all async callbacks static void LIBUSB_CALL libusb_async_cb(libusb_transfer *lut){ - *(static_cast<bool *>(lut->user_data)) = true; + int *completed = (int *)lut->user_data; + *completed = 1; } /*! @@ -61,7 +62,7 @@ static void LIBUSB_CALL libusb_async_cb(libusb_transfer *lut){ * \param completed a reference to the completed flag * \return true for completion, false for timeout */ -UHD_INLINE bool wait_for_completion(libusb_context *ctx, const double timeout, bool &completed){ +UHD_INLINE bool wait_for_completion(libusb_context *ctx, const double timeout, int &completed){ //already completed by a previous call? if (completed) return true; @@ -96,7 +97,7 @@ public: _lut(lut), _frame_size(frame_size) { /* NOP */ } void release(void){ - completed = false; + completed = 0; _lut->length = _frame_size; //always reset length UHD_ASSERT_THROW(libusb_submit_transfer(_lut) == 0); } @@ -109,7 +110,7 @@ public: return managed_recv_buffer::sptr(); } - bool completed; + int completed; private: libusb_context *_ctx; @@ -129,7 +130,7 @@ public: _lut(lut), _frame_size(frame_size) { completed = true; } void release(void){ - completed = false; + completed = 0; _lut->length = size(); UHD_ASSERT_THROW(libusb_submit_transfer(_lut) == 0); } @@ -142,7 +143,7 @@ public: return managed_send_buffer::sptr(); } - bool completed; + int completed; private: libusb_context *_ctx; @@ -249,7 +250,7 @@ public: } //process all transfers until timeout occurs - bool completed = false; + int completed = 0; wait_for_completion(ctx, 0.01, completed); //free all transfers |