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] [December 2015 Threads] Behaviour of nested calls to xSemaphoreTake with mutex in same taskPosted by pugglewuggle on December 22, 2015 If a task has already obtained a mutex will a calling xSemphoreTake on the same mutex in the same task (for example, in a function being called) succeed or fail?
Behaviour of nested calls to xSemaphoreTake with mutex in same taskPosted by rtel on December 22, 2015 A standard mutex can only be taken once, so nested calls to attempt to take a standard mutex will fail. This is quite easy for you to test, or determine from the code.
If you want the possibility to obtain the same mutex twice (at once) then you will instead need to create a recursive mutex.
Behaviour of nested calls to xSemaphoreTake with mutex in same taskPosted by pugglewuggle on March 2, 2016 To be clear, do I need to give that mutex the same number of times I take it?
Behaviour of nested calls to xSemaphoreTake with mutex in same taskPosted by richard_damon on March 2, 2016 If it is a non-recursive mutex, if you already have it, you shouldn't call take again.
If it is a recursive mutex, you need to give it as many times as you took it.
Note, recursive mutexes use xSemaphoreTakeRecursive/xSemaphoreGiveRecursive instead of the simple xSemaphoreTask and xSemaphoreGive.
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.
|