Git Product home page Git Product logo

Comments (5)

JvanKatwijk avatar JvanKatwijk commented on June 26, 2024

from dab-cmdline.

srcejon avatar srcejon commented on June 26, 2024

The problem will occur if dabReset() is called twice quickly. Perhaps adding this to one of the examples will show it.

You can see there is a potential problem just by looking at the code for start(), stop() and run() though:

stop() uses 'running' to determine whether to join:

if (running. load ()) {
   running. store (false);
   myReader. setRunning (false);
   sleep (1);
   threadHandle. join ();

}

However, the running variable is only set some lines of code in to run()

void dabProcessor::run (void) {
std::complex FreqCorr;
timeSyncer myTimeSyncer (&myReader);
int32_t i;
float fineOffset = 0;
float coarseOffset = 0;
bool correctionNeeded = true;
std::vector<complex> ofdmBuffer (T_null);
int dip_attempts = 0;
int index_attempts = 0;
int startIndex = -1;

  isSynced	= false;
  snr		= 0;
  running. store (true);  //// Set here <----

If reset() is called twice quickly, it's possible that running isn't yet set from the first invocation when stop is called for the second invocation. This means join doesn't get called - and so when the thread destructor is called, terminate() is called as the thread is still joinable.

Unfortunately, just setting running to true in start() isn't enough. That ensures join is called - but the thread sometimes doesn't end.

from dab-cmdline.

JvanKatwijk avatar JvanKatwijk commented on June 26, 2024

from dab-cmdline.

srcejon avatar srcejon commented on June 26, 2024

That is because the DAB library was designed for just running a single service in a single channel.

I believe that is all that we are doing. What I think happens is the following:

  • When the user changes the frequency, dabReset() is called.
  • stop() in the dab library has a 1 second delay.
  • This is long enough, that the user could change the frequency again, while it is waiting, resulting in a second call to dabReset() getting queued, so it is called immediately after the first returns.

I guess I could add some code to prevent that - but calling dabReset() twice in succession didn't seem unreasonable.

from dab-cmdline.

JvanKatwijk avatar JvanKatwijk commented on June 26, 2024

from dab-cmdline.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.