Ensure fast exit
transfer_threadproc has a timeout of half a second, so when kill_transfer_thread tries to pthread_join, it often has to wait until the timeout kicks in. With this fix, we ensure that a final request is made after request_exit has been called, so that transfer_threadproc can exit its loop in a fast and clean manner.
This commit is contained in:
@ -1786,6 +1786,13 @@ static int kill_transfer_thread(hackrf_device* device)
|
||||
* Now call request_exit() to halt the main loop.
|
||||
*/
|
||||
request_exit(device);
|
||||
/*
|
||||
* Make a final request, so that threadproc can exit immediately,
|
||||
* without waiting for timeout. Don't care about result.
|
||||
*/
|
||||
uint8_t board_id;
|
||||
result = hackrf_board_id_read(device, &board_id);
|
||||
|
||||
value = NULL;
|
||||
result = pthread_join(device->transfer_thread, &value);
|
||||
if( result != 0 )
|
||||
|
Reference in New Issue
Block a user