From 8b0651ea13424a3ce256b5d05dd97d3535cb9eea Mon Sep 17 00:00:00 2001 From: Hayley Date: Fri, 9 Aug 2019 11:20:04 -0500 Subject: [PATCH 1/2] Added usleep to connect thread to keep from taking all of the CPU --- DSP_API/ThumbDV/thumbDV.c | 1 + 1 file changed, 1 insertion(+) diff --git a/DSP_API/ThumbDV/thumbDV.c b/DSP_API/ThumbDV/thumbDV.c index c8aa797..d87807f 100644 --- a/DSP_API/ThumbDV/thumbDV.c +++ b/DSP_API/ThumbDV/thumbDV.c @@ -786,6 +786,7 @@ static void * _thumbDV_connectThread( void * param ) while ( !_connectThreadAbort ) { //TODO Handle reconnection ret = FT_GetStatus(handle, &rx_bytes, &tx_bytes, &event_dword); + usleep(1000000); if (ret != FT_OK) { From eaa4688355c1d49a1d8430b6a2e0748ee601baee Mon Sep 17 00:00:00 2001 From: Hayley Date: Fri, 9 Aug 2019 11:24:10 -0500 Subject: [PATCH 2/2] Added comment to connect thread to explain usleep --- DSP_API/ThumbDV/thumbDV.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/DSP_API/ThumbDV/thumbDV.c b/DSP_API/ThumbDV/thumbDV.c index d87807f..8f7a191 100644 --- a/DSP_API/ThumbDV/thumbDV.c +++ b/DSP_API/ThumbDV/thumbDV.c @@ -784,9 +784,10 @@ static void * _thumbDV_connectThread( void * param ) FT_HANDLE handle = *(FT_HANDLE *) param; while ( !_connectThreadAbort ) { - //TODO Handle reconnection - ret = FT_GetStatus(handle, &rx_bytes, &tx_bytes, &event_dword); + + //waits 1 second before checking status to prevent CPU hogging usleep(1000000); + ret = FT_GetStatus(handle, &rx_bytes, &tx_bytes, &event_dword); if (ret != FT_OK) {