mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-08-19 17:48:33 -04:00
Added xSemaphoreGetMutexHolder() macro and equivalent function.
This commit is contained in:
parent
6dc8b56cb6
commit
2658a3b6ef
3 changed files with 57 additions and 9 deletions
|
@ -56,7 +56,7 @@
|
|||
#define QUEUE_H
|
||||
|
||||
#ifndef INC_FREERTOS_H
|
||||
#error "#include FreeRTOS.h" must appear in source files before "#include queue.h"
|
||||
#error "include FreeRTOS.h" must appear in source files before "include queue.h"
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -1221,11 +1221,13 @@ signed portBASE_TYPE xQueueCRSend( xQueueHandle pxQueue, const void *pvItemToQue
|
|||
signed portBASE_TYPE xQueueCRReceive( xQueueHandle pxQueue, void *pvBuffer, portTickType xTicksToWait );
|
||||
|
||||
/*
|
||||
* For internal use only. Use xSemaphoreCreateMutex() or
|
||||
* xSemaphoreCreateCounting() instead of calling these functions directly.
|
||||
* For internal use only. Use xSemaphoreCreateMutex(),
|
||||
* xSemaphoreCreateCounting() or xSemaphoreGetMutexHolder() instead of calling
|
||||
* these functions directly.
|
||||
*/
|
||||
xQueueHandle xQueueCreateMutex( unsigned char ucQueueType );
|
||||
xQueueHandle xQueueCreateCountingSemaphore( unsigned portBASE_TYPE uxCountValue, unsigned portBASE_TYPE uxInitialCount );
|
||||
void* xQueueGetMutexHolder( xQueueHandle xSemaphore );
|
||||
|
||||
/*
|
||||
* For internal use only. Use xSemaphoreTakeMutexRecursive() or
|
||||
|
|
|
@ -55,7 +55,7 @@
|
|||
#define SEMAPHORE_H
|
||||
|
||||
#ifndef INC_FREERTOS_H
|
||||
#error "#include FreeRTOS.h" must appear in source files before "#include semphr.h"
|
||||
#error "include FreeRTOS.h" must appear in source files before "include semphr.h"
|
||||
#endif
|
||||
|
||||
#include "queue.h"
|
||||
|
@ -718,7 +718,22 @@ typedef xQueueHandle xSemaphoreHandle;
|
|||
* \page vSemaphoreDelete vSemaphoreDelete
|
||||
* \ingroup Semaphores
|
||||
*/
|
||||
#define vSemaphoreDelete( xSemaphore ) vQueueDelete( ( xQueueHandle ) xSemaphore )
|
||||
#define vSemaphoreDelete( xSemaphore ) vQueueDelete( ( xQueueHandle ) ( xSemaphore ) )
|
||||
|
||||
/**
|
||||
* semphr.h
|
||||
* <pre>xTaskHandle xSemaphoreGetMutexHolder( xSemaphoreHandle xMutex );</pre>
|
||||
*
|
||||
* If xMutex is indeed a mutex type semaphore, return the current mutex holder.
|
||||
* If xMutex is not a mutex type semaphore, or the mutex is available (not held
|
||||
* by a task), return NULL.
|
||||
*
|
||||
* Note: This Is is a good way of determining if the calling task is the mutex
|
||||
* holder, but not a good way of determining the identity of the mutex holder as
|
||||
* the holder may change between the function exiting and the returned value
|
||||
* being tested.
|
||||
*/
|
||||
#define xSemaphoreGetMutexHolder( xSemaphore ) xQueueGetMutexHolder( ( xSemaphore ) )
|
||||
|
||||
#endif /* SEMAPHORE_H */
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue