<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On 15 February 2015 at 13:38, Oliver Jowett <span dir="ltr"><<a href="mailto:oliver.jowett@gmail.com" target="_blank">oliver.jowett@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr">What's the "right way" to call rtlsdr_* functions while receiving samples via rtlsdr_read_async()?<div>e.g. to change frequency or gain mid-run.</div></div></blockquote><div><br></div><div>Some work in this area:</div><div><br></div><div><a href="https://github.com/mutability/librtlsdr/tree/async-rearrangements">https://github.com/mutability/librtlsdr/tree/async-rearrangements</a> - Rearranging rtlsdr_read_async() so that rtlsdr callbacks are not done from within the libusb callback. This allows you to safely call rtlsdr_* from within the async callback.</div><div><br></div><div><a href="https://github.com/mutability/librtlsdr/tree/thread-safety">https://github.com/mutability/librtlsdr/tree/thread-safety</a> - makes device access threadsafe (in theory), so you can safely call rtlsdr_* from multiple threads (including while rtlsdr_read_async is running)<br></div><div><br></div><div>Oliver</div><div><br></div></div></div></div>