# Are callbacks or signals available

**URL:** <https://discourse.myriadrf.org/t/are-callbacks-or-signals-available/7004>\
**Category:** LimeSDR\
**Created:** [5 March 2021 18:00 UTC](https://discourse.myriadrf.org/t/are-callbacks-or-signals-available/7004 "2021-03-05T18:00:05Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![hermelin](https://avatars.discourse-cdn.com/v4/letter/h/f475e1/32.png) [@hermelin](https://discourse.myriadrf.org/u/hermelin)\
**Post date:** [5 March 2021 18:00 UTC](https://discourse.myriadrf.org/t/are-callbacks-or-signals-available/7004/1 "2021-03-05T18:00:05Z")

</div>

Hi all,  
I’m looking for a possibility to avoid the loop to get the samples by e.g:

while (1) {  
int i = LMS\_RecvStream(&streamId, buffer, bufersize, NULL, 1000);  
do\_something();  
}

Is there is the possibility to call a function (asynchronously), e.g. if a buffer has been filled with 5000 samples. In the C ++ world there is e.g. sigc ++, something like this:

device-\>sampleBufferfull.connect (  
sigc::ptr\_fun(myClass::callupfuntion));

The only method I noticed would be LMS\_Program() but I’m not sure if that’s the right approach.  
I’m grateful for a little tip  
Many greetings  
Adi

---

<div class="post-metadata">

**Author:** ![yt7pwr](https://avatars.discourse-cdn.com/v4/letter/y/ecd19e/32.png) [@yt7pwr](https://discourse.myriadrf.org/u/yt7pwr)\
**Post date:** [5 March 2021 18:19 UTC](https://discourse.myriadrf.org/t/are-callbacks-or-signals-available/7004/2 "2021-03-05T18:19:52Z")

</div>

Why not use separate thread for receive task?

---

<div class="post-metadata">

**Author:** ![hermelin](https://avatars.discourse-cdn.com/v4/letter/h/f475e1/32.png) [@hermelin](https://discourse.myriadrf.org/u/hermelin)\
**Post date:** [5 March 2021 18:36 UTC](https://discourse.myriadrf.org/t/are-callbacks-or-signals-available/7004/3 "2021-03-05T18:36:52Z")

</div>

the project in which i want to integrate my code was based exclusively on asynchronous processing and signals. The chief programmer would not accept such a poll loop.

---

<div class="post-metadata">

**Author:** ![yt7pwr](https://avatars.discourse-cdn.com/v4/letter/y/ecd19e/32.png) [@yt7pwr](https://discourse.myriadrf.org/u/yt7pwr)\
**Post date:** [5 March 2021 19:05 UTC](https://discourse.myriadrf.org/t/are-callbacks-or-signals-available/7004/4 "2021-03-05T19:05:07Z")

</div>

In my project I use pthread and circular buffer. Separate thread receive data from LimeSDR and store them in circular buffer. If amount of data in buffer is enough for DSP task receive thread sends signal using pthread semaphore system. DSP thread wait for semaphore signal to perform task. All these processes are asyncronious and have no effect on main thread. By “poll loop” usually comes term “blocking call” which can be dangerous but in this case you depends on LimeSuite library in either variant.

---

<div class="post-metadata">

**Author:** ![hermelin](https://avatars.discourse-cdn.com/v4/letter/h/f475e1/32.png) [@hermelin](https://discourse.myriadrf.org/u/hermelin)\
**Post date:** [5 March 2021 19:14 UTC](https://discourse.myriadrf.org/t/are-callbacks-or-signals-available/7004/5 "2021-03-05T19:14:18Z")

</div>

Thank you for your information, which has brought me a step further. I think that’s one approach I could try.  
mni 73s de Adi / DL1HRC 😃
