mirror of
https://github.com/apache/nuttx.git
synced 2025-01-13 08:38:38 +08:00
mutex: add nxrmutex_is_recursive api
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
This commit is contained in:
parent
a2b8c83e0e
commit
667de7be32
2 changed files with 35 additions and 0 deletions
|
@ -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
|
||||
*
|
||||
|
|
|
@ -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
|
||||
*
|
||||
|
|
Loading…
Reference in a new issue