Skip to content

Commit

Permalink
Replace tb->lock() / unlock() with start() / stop().
Browse files Browse the repository at this point in the history
lock() / unlock() seems to cause occasioanly hangs.
  • Loading branch information
csete committed Apr 11, 2014
1 parent b118d55 commit eca0ea7
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
1 change: 0 additions & 1 deletion applications/gqrx/mainwindow.cpp
Expand Up @@ -833,7 +833,6 @@ void MainWindow::selectDemod(int index)
rx->set_demod(receiver::RX_DEMOD_WFM_M);
else
rx->set_demod(receiver::RX_DEMOD_WFM_S);

break;

/* LSB */
Expand Down
23 changes: 19 additions & 4 deletions applications/gqrx/receiver.cpp
Expand Up @@ -179,13 +179,20 @@ void receiver::set_input_device(const std::string device)

input_devstr = device;

tb->lock();
// tb->lock() can hang occasionally
if (d_running)
{
tb->stop();
tb->wait();
}

tb->disconnect(src, 0, iq_swap, 0);
src.reset();
src = osmosdr::source::make(device);
tb->connect(src, 0, iq_swap, 0);
tb->unlock();

if (d_running)
tb->start();
}


Expand Down Expand Up @@ -673,7 +680,13 @@ receiver::status receiver::set_demod(rx_demod demod)
//if (demod == d_demod)
// return ret;

tb->lock();
// tb->lock() seems to hang occasioanlly
if (d_running)
{
tb->stop();
tb->wait();
}

tb->disconnect_all();

switch (demod)
Expand Down Expand Up @@ -718,7 +731,9 @@ receiver::status receiver::set_demod(rx_demod demod)
}

d_demod = demod;
tb->unlock();

if (d_running)
tb->start();

return ret;
}
Expand Down

0 comments on commit eca0ea7

Please sign in to comment.