diff --git a/src/ifce/btrMgr.c b/src/ifce/btrMgr.c index 98371b2a..5cfe9189 100644 --- a/src/ifce/btrMgr.c +++ b/src/ifce/btrMgr.c @@ -4695,7 +4695,7 @@ BTRMGR_StartDeviceDiscovery_Internal ( do { usleep(5000); - } while ((!gIsAdapterDiscovering) && (--ui32sleepIdx)); + } while ((!gIsAdapterDiscovering) && (--ui32sleepIdx) && !isDeinitInProgress); } if (!gIsAdapterDiscovering) { @@ -4775,8 +4775,7 @@ BTRMGR_StopDeviceDiscovery_Internal ( { /* Max 6 sec timeout - Polled at 50ms interval */ unsigned int ui32sleepIdx = 120; - - while ((gIsAdapterDiscovering) && (ui32sleepIdx--)) { + while ((gIsAdapterDiscovering) && (ui32sleepIdx--) && !isDeinitInProgress) { usleep(50000); } } diff --git a/unitTest/unitTest_btmgr/test_btrMgr.c b/unitTest/unitTest_btmgr/test_btrMgr.c index 658dedd4..08d11c77 100644 --- a/unitTest/unitTest_btmgr/test_btrMgr.c +++ b/unitTest/unitTest_btmgr/test_btrMgr.c @@ -123,7 +123,7 @@ void setUp(void) gstBTRMgrStreamingInfo.channels = 0; gstBTRMgrStreamingInfo.bitsPerSample = 0; gstBTRMgrStreamingInfo.i32BytesToEncode = 0; - + isDeinitInProgress = FALSE; } void tearDown(void) { // Clean up any necessary variables or state after each test