discuss-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: work function sleep


From: Jim Melton
Subject: RE: work function sleep
Date: Tue, 7 Jun 2022 19:18:45 +0000

Daniel,

 

When reading from a socket, you have to ensure you service the socket at least as fast as the data arrives or else you will drop data (UDP) or block the sender (TCP). Neither of these scenarios are acceptable, as lost data will appear as a discontinuity in your GNU Radio data stream. So, you can spin a thread that services the socket with a blocking call and writes to an internal buffer, but then you have the issue of the buffer filling up if GNU Radio doesn’t consume your data fast enough. Or, you can do a blocking read on the socket and hope that GNU Radio calls you fast enough. Either way, you need a mechanism to detect and handle dropped data.

 

I’m using the CyberRadio Solutions vita_udp_rx block (ok, I may have re-written it for them), and after lots of discussion with the smart GNU Radio guys, I opted for a blocking read. This led me to identify and resolve some other issues in my flowgraph that were causing data drops at the front end.

 

To your specific question, yes, that’s a linker error. You don’t have the library that includes boost::chrono, but since std::chrono is in the C++11 standard, you can just use that. Using standard C++, your  example would be:

 

std::this_thread::sleep_for(std::chrono::milliseconds(10));

 

---

Jim Melton



 

From: Discuss-gnuradio  On Behalf Of Perkins, Daniel (US)
Sent: Tuesday, June 7, 2022 06:44
To: discuss-gnuradio@gnu.org
Subject: [EXTERNAL] work function sleep

 

The blocks coding guide (https://wiki.gnuradio.org/index.php/BlocksCodingGuide) suggests that if a blocking function must be used in the work function, that a boost thread call such as sleep should be used.  In my case, I am reading IQ data from a socket using the recvfrom function that I can call as a non-blocking function in a loop containing a sleep function.  Is the following sleep function the right one?

 

boost::this_thread::sleep_for(boost::chrono::milliseconds(10))

 

When I attempt to use this, I get a run-time error message stating  that_ZN5boost6chrono12steady_clkck3nowEv is an undefined symbol.  I expect that this is a linker error.  I have included boost_system in my list of target_link_libraries.  I’m just not sure if this is even the recommended sleep function to call.  Is there another preferred method? 

 

CONFIDENTIALITY NOTICE - SNC EMAIL: This email and any attachments are confidential, may contain proprietary, protected, or export controlled information, and are intended for the use of the intended recipients only. Any review, reliance, distribution, disclosure, or forwarding of this email and/or attachments outside of Sierra Nevada Corporation (SNC) without express written approval of the sender, except to the extent required to further properly approved SNC business purposes, is strictly prohibited. If you are not the intended recipient of this email, please notify the sender immediately, and delete all copies without reading, printing, or saving in any manner. --- Thank You.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]