Hi, I am trying to figure out the ID value when thread, sem or mutex is not present. Which value does the ID take, 0 or NULL?
What do you mean by ID here? Do you want to ask what to initialize a mutex handle to? If so, you can use NULL -
SemaphoreHandle_t xMutex = NULL;
xMutex = xSemaphoreCreateMutex();
if( xMutex != NULL )
{
/* Use mutex. */
}
My question is when I declare xMutex without giving a value like this:
SemaphoreHandle_t xMutex;
What is the value of xMutex initially?
If it’s a global or static variable it’s zero initialized i.e. NULL following the C standard.
That’s not directly related to FreeRTOS.
2 Likes