Fix/Middleware thread safety
@@ -297,7 +297,8 @@ BaseType_t prvGetAttributeFromHandle( uint16_t usAttrHandle,
BaseType_t bFoundService = pdFAIL;
/* The service that was just added is the last in the list */
-/* TODO ADD A MUTEX */
+ if( xSemaphoreTake( ( SemaphoreHandle_t ) &xBTInterface.xThreadSafetyMutex, portMAX_DELAY ) == pdPASS )
+ {
listFOR_EACH( pxTmpElem, &xBTInterface.xServiceListHead )
{
pxServiceElem = listCONTAINER( pxTmpElem, BLEServiceListElement_t, xServiceList );
@@ -308,6 +309,8 @@ BaseType_t prvGetAttributeFromHandle( uint16_t usAttrHandle,
break;
}
}
+ xSemaphoreGive( ( SemaphoreHandle_t ) &xBTInterface.xThreadSafetyMutex );
+ }
if( bFoundService == pdPASS )
{
