[USRP-users] Timeout while streaming error while implementing receiving samples in different thread

kamal kumar jeldi jeldi.kamal2011 at gmail.com
Wed Apr 29 02:33:38 EDT 2015

*P.S: This question might be more of related to C++ programming. But the
methodology works fine on normal compilation but does not work after
integrating with UHD.*

Hi All,

I am using B210 USRP Board. I am trying to implement two threads ( one for
recieving samples and another for processing received samples from other
thread ) using concurrent_queue which stores pointers to std::vector<
std::complex<T> >. Here is the declaration:

std::concurrent_queue< std::vector< std::complex<T> > * > DataQueue;

concurrent_queue is implemented thread safe using mutex and conditional

The recieving thread( one of two threads) receives samples issues
*recv *command
and receives the samples. So, in order to insert a pointer to new received
data, I need a new reference to each samples data for each iteration hence
I came up with this semantics,

     std::vector < std::complex<T> > *buff = new std::vector<
std::complex<T> >( samples_per_buffer);
     std::vector< std::complex<T> > &r = *buff   //just de-referencing the
     size_t num_rx_samps = rx_stream->recv(&r.front(),rx_samps_num, md,
3.0, enable_size_map);


      //error checking code goes here

The processing thread, just locks this globally defined DataQueue and pops
one pointer and unlocks the queue. Processing part on this popped pointer.

In the main thread, I am starting the thread using std::thread library from
C++11 standards as,

#define DataAcquisition_args() \
    usrp, format, wirefmt, spb, total_num_samps, extra_samples, total_time,
bw_summary, stats, null, enable_size_map, continue_on_bad_packet


I have compiled the code with necessary libraries and compiler switches.
The code compiles perfectly to produce the executable. but when the program
is executed, It shows the following error,

*Timeout while streaming*.

Am I making anything wrong while sending parameters to
DataAcquistionThread...??? Where am i going wrong..??

Please help me.. Thanks in advance...
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ettus.com/pipermail/usrp-users_lists.ettus.com/attachments/20150429/68167a29/attachment-0002.html>

More information about the USRP-users mailing list