mutex: add nxrmutex_is_recursive api

Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
This commit is contained in:
yinshengkai 2024-07-03 15:21:57 +08:00 committed by Xiang Xiao
parent a2b8c83e0e
commit 667de7be32
2 changed files with 35 additions and 0 deletions

View File

@ -392,6 +392,22 @@ int nxrmutex_destroy(FAR rmutex_t *rmutex);
bool nxrmutex_is_hold(FAR rmutex_t *rmutex);
/****************************************************************************
* Name: nxrmutex_is_recursive
*
* Description:
* This function check whether the recursive mutex is recursive
*
* Parameters:
* rmutex - Recursive mutex descriptor.
*
* Return Value:
* If rmutex has returned to True recursively, otherwise returns false.
*
****************************************************************************/
bool nxrmutex_is_recursive(FAR rmutex_t *rmutex);
/****************************************************************************
* Name: nxrmutex_get_holder
*

View File

@ -553,6 +553,25 @@ bool nxrmutex_is_hold(FAR rmutex_t *rmutex)
return nxmutex_is_hold(&rmutex->mutex);
}
/****************************************************************************
* Name: nxrmutex_is_recursive
*
* Description:
* This function check whether the recursive mutex is recursive
*
* Parameters:
* rmutex - Recursive mutex descriptor.
*
* Return Value:
* If rmutex has returned to True recursively, otherwise returns false.
*
****************************************************************************/
bool nxrmutex_is_recursive(FAR rmutex_t *rmutex)
{
return rmutex->count > 1;
}
/****************************************************************************
* Name: nxrmutex_get_holder
*