summaryrefslogtreecommitdiff
path: root/Source/queue.c
diff options
context:
space:
mode:
authorrichardbarry <richardbarry@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>2008-05-19 19:16:57 +0000
committerrichardbarry <richardbarry@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>2008-05-19 19:16:57 +0000
commit9b283f483db18d06b2d071021210af0d9c3f96d8 (patch)
treef1e792ac81ca8997eb1fcb4caacbb330feb689bd /Source/queue.c
parent64e4417235f4ae903218beee4c34cbabab381f37 (diff)
downloadfreertos-9b283f483db18d06b2d071021210af0d9c3f96d8.tar.gz
freertos-9b283f483db18d06b2d071021210af0d9c3f96d8.tar.bz2
freertos-9b283f483db18d06b2d071021210af0d9c3f96d8.tar.xz
Change the way the critical sections are handled within interrupts so the critical sections can be nested.
git-svn-id: https://freertos.svn.sourceforge.net/svnroot/freertos/trunk@361 1d2547de-c912-0410-9cb9-b8ca96c0e9e2
Diffstat (limited to 'Source/queue.c')
-rw-r--r--Source/queue.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/Source/queue.c b/Source/queue.c
index b31893d3..b7ef66f2 100644
--- a/Source/queue.c
+++ b/Source/queue.c
@@ -690,9 +690,7 @@ xTimeOutType xTimeOut;
{
if( pxQueue->uxQueueType == queueQUEUE_IS_MUTEX )
{
- portENTER_CRITICAL();
- vTaskPriorityInherit( ( void * ) pxQueue->pxMutexHolder );
- portEXIT_CRITICAL();
+ vTaskPriorityInherit( ( void * ) pxQueue->pxMutexHolder );
}
}
#endif
@@ -802,13 +800,14 @@ xTimeOutType xTimeOut;
signed portBASE_TYPE xQueueGenericSendFromISR( xQueueHandle pxQueue, const void * const pvItemToQueue, signed portBASE_TYPE *pxHigherPriorityTaskWoken, portBASE_TYPE xCopyPosition )
{
signed portBASE_TYPE xReturn;
+unsigned portBASE_TYPE uxSavedInterruptStatus;
/* Similar to xQueueGenericSend, except we don't block if there is no room
in the queue. Also we don't directly wake a task that was blocked on a
queue read, instead we return a flag to say whether a context switch is
required or not (i.e. has a task with a higher priority than us been woken
by this post). */
- portSET_INTERRUPT_MASK_FROM_ISR();
+ uxSavedInterruptStatus = portSET_INTERRUPT_MASK_FROM_ISR();
{
if( pxQueue->uxMessagesWaiting < pxQueue->uxLength )
{
@@ -845,7 +844,7 @@ signed portBASE_TYPE xReturn;
xReturn = errQUEUE_FULL;
}
}
- portCLEAR_INTERRUPT_MASK_FROM_ISR();
+ portCLEAR_INTERRUPT_MASK_FROM_ISR( uxSavedInterruptStatus );
return xReturn;
}
@@ -1007,8 +1006,9 @@ signed portCHAR *pcOriginalReadPosition;
signed portBASE_TYPE xQueueReceiveFromISR( xQueueHandle pxQueue, void * const pvBuffer, signed portBASE_TYPE *pxTaskWoken )
{
signed portBASE_TYPE xReturn;
+unsigned portBASE_TYPE uxSavedInterruptStatus;
- portSET_INTERRUPT_MASK_FROM_ISR();
+ uxSavedInterruptStatus = portSET_INTERRUPT_MASK_FROM_ISR();
{
/* We cannot block from an ISR, so check there is data available. */
if( pxQueue->uxMessagesWaiting > ( unsigned portBASE_TYPE ) 0 )
@@ -1048,7 +1048,7 @@ signed portBASE_TYPE xReturn;
traceQUEUE_RECEIVE_FROM_ISR_FAILED( pxQueue );
}
}
- portCLEAR_INTERRUPT_MASK_FROM_ISR();
+ portCLEAR_INTERRUPT_MASK_FROM_ISR( uxSavedInterruptStatus );
return xReturn;
}