FreeRTOS Support Archive
The FreeRTOS support forum is used to obtain active support directly from Real
Time Engineers Ltd. In return for using our top quality software and services for
free, we request you play fair and do your bit to help others too! Sign up
to receive notifications of new support topics then help where you can.
This is a read only archive of threads posted to the FreeRTOS support forum.
The archive is updated every week, so will not always contain the very latest posts.
Use these archive pages to search previous posts. Use the Live FreeRTOS Forum
link to reply to a post, or start a new support thread.
[FreeRTOS Home] [Live FreeRTOS Forum] [FAQ] [Archive Top] [June 2017 Threads]
Hello, I'm keep learning FreeRTOS source code,
But in queue.c, I'm not really understand why need cRxLock and cTxLock,
I know that in send or receive function it can lock rx and tx when it check the timeout,
and in this situation the ISR event will record in cRxLock and cTxLock,
after checking timeout, it will check Lock value and release lock.
But I think the check timeout is not really long, why just put check into critical section,
then there is no need to use cRxLock and cTxLock and save release lock which is not short execute
I think maybe there is a key to design Lock, can anyone give me some hint, thanks
As I recall the rx and tx locks are used to allow queues to be used from
tasks and interrupts at the same time. If a queue is locked then an
interrupt using the queue knows it can modify some data structures but
not others - the structures it can't modify are then modified from the
task level when the queue is unlocked. So:
1) A task locks a queue and starts accessing it.
2) An interrupt uses the queue, but noticing it is locked, does not
complete the queue operation.
3) When the task unlocks the queue it notices an interrupt also accessed
the queue and completes the operation the interrupts started.
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.