wait for something to read in ReadDevice

main
Tom Early 4 years ago
parent df1fb39f36
commit 65d0c7702c

@ -174,7 +174,6 @@ bool CController::InitDevices()
// based on packet's codec_in.
void CController::ReadReflectorThread()
{
std::cout << "ReadReflector tid=" << gettid() << " get_id=" << std::this_thread::get_id() << std::endl;
while (keep_running)
{
STCPacket tcpack;
@ -290,7 +289,6 @@ void CController::Codec2toAudio(std::shared_ptr<CTranscoderPacket> packet)
void CController::ProcessC2Thread()
{
std::cout << "ProcessC2 tid=" << gettid() << " get_id=" << std::this_thread::get_id() << std::endl;
while (keep_running)
{
auto packet = codec2_queue.pop();

@ -512,7 +512,6 @@ bool CDV3003::GetResponse(SDV3003_Packet &packet)
void CDV3003::FeedDevice()
{
std::cout << "FeedDevice tid=" << gettid() << " get_id=" << std::this_thread::get_id() << std::endl;
const std::string modules(TRANSCODED_MODULES);
const auto n = modules.size();
while (keep_running)
@ -558,9 +557,23 @@ void CDV3003::FeedDevice()
void CDV3003::ReadDevice()
{
std::cout << "ReadDevice tid=" << gettid() << " get_id=" << std::this_thread::get_id() << std::endl;
while (keep_running)
{
// wait for something to read...
DWORD n = 0;
while (0 == n)
{
auto status = FT_GetQueueStatus(ftHandle, &n);
if (FT_OK != status)
{
FTDI_Error("FT_GetQueueStatus", status);
break;
}
if (0 == n)
std::this_thread::sleep_for(std::chrono::milliseconds(2));
}
dv3003_packet p;
if (! GetResponse(p))
{

Loading…
Cancel
Save

Powered by TurnKey Linux.