mirror of
https://github.com/n5ac/smartsdr-dsp.git
synced 2025-12-06 03:01:59 +01:00
Blocking read instead of polling for _thumbDV_readThread()
This commit is contained in:
parent
c5bd30c090
commit
06cf3e975c
|
|
@ -715,11 +715,26 @@ static void * _thumbDV_readThread( void * param )
|
||||||
|
|
||||||
FT_STATUS status = FT_OK;
|
FT_STATUS status = FT_OK;
|
||||||
FT_HANDLE handle = *( FT_HANDLE * )param;
|
FT_HANDLE handle = *( FT_HANDLE * )param;
|
||||||
|
EVENT_HANDLE event_handle;
|
||||||
|
|
||||||
prctl(PR_SET_NAME, "DV-Read");
|
prctl(PR_SET_NAME, "DV-Read");
|
||||||
|
|
||||||
|
pthread_mutex_init(&event_handle.eMutex, NULL);
|
||||||
|
pthread_cond_init(&event_handle.eCondVar, NULL);
|
||||||
|
|
||||||
while ( !_readThreadAbort )
|
while ( !_readThreadAbort )
|
||||||
{
|
{
|
||||||
|
// Setup RX or Status change event notification
|
||||||
|
status = FT_SetEventNotification(handle, FT_EVENT_RXCHAR | FT_EVENT_MODEM_STATUS, (PVOID)&event_handle);
|
||||||
|
|
||||||
|
// Will block until
|
||||||
|
pthread_mutex_lock(&event_handle.eMutex);
|
||||||
|
pthread_cond_wait(&event_handle.eCondVar, &event_handle.eMutex);
|
||||||
|
pthread_mutex_unlock(&event_handle.eMutex);
|
||||||
|
|
||||||
|
do
|
||||||
|
{
|
||||||
|
rx_bytes = 0;
|
||||||
status = FT_GetStatus(handle, &rx_bytes, &tx_bytes, &event_dword);
|
status = FT_GetStatus(handle, &rx_bytes, &tx_bytes, &event_dword);
|
||||||
|
|
||||||
if ( status != FT_OK )
|
if ( status != FT_OK )
|
||||||
|
|
@ -738,10 +753,7 @@ static void * _thumbDV_readThread( void * param )
|
||||||
{
|
{
|
||||||
ret = thumbDV_processSerial( handle );
|
ret = thumbDV_processSerial( handle );
|
||||||
}
|
}
|
||||||
else
|
} while ( rx_bytes > 0 );
|
||||||
{
|
|
||||||
usleep(50000);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
output( ANSI_YELLOW "thumbDV_readThread has exited\n" ANSI_WHITE );
|
output( ANSI_YELLOW "thumbDV_readThread has exited\n" ANSI_WHITE );
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue