Add some comments.
This commit is contained in:
parent
b0dffdc2ca
commit
6f1c5e7b43
|
@ -79,12 +79,12 @@ void mm_addregion(FAR struct mm_heap_s *heap, FAR void *heapstart,
|
|||
# define IDX 0
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_MM_SMALL) && !defined(CONFIG_SMALL_MEMORY)
|
||||
/* If the MCU handles wide addresses but the memory manager is configured
|
||||
* for a small heap, then verify that the caller is not doing something
|
||||
* crazy.
|
||||
*/
|
||||
|
||||
#if defined(CONFIG_MM_SMALL) && !defined(CONFIG_SMALL_MEMORY)
|
||||
DEBUGASSERT(heapsize <= MMSIZE_MAX+1);
|
||||
#endif
|
||||
|
||||
|
|
|
@ -98,7 +98,22 @@ int sem_post(FAR sem_t *sem)
|
|||
|
||||
flags = enter_critical_section();
|
||||
|
||||
/* Perform the semaphore unlock operation. */
|
||||
/* Perform the semaphore unlock operation, releasing this task as a
|
||||
* holder then also incrementing the count on the semaphore.
|
||||
*
|
||||
* NOTE: When semaphores are used for signaling purposes, the holder
|
||||
* of the semaphore may not be this thread! In this case,
|
||||
* sem_releaseholder() will do nothing.
|
||||
*
|
||||
* In the case of a mutex this could be simply resolved since there is
|
||||
* only one holder but for the case of counting semaphores, there may
|
||||
* be many holders and if the holder is not this thread, then it is
|
||||
* not possible to know which thread/holder should be released.
|
||||
*
|
||||
* For this reason, it is recommended that priority inheritance be
|
||||
* disabled via sem_setprotocol(SEM_PRIO_NONE) when the semahore is
|
||||
* initialixed if the semaphore is to used for signaling purposes.
|
||||
*/
|
||||
|
||||
ASSERT(sem->semcount < SEM_VALUE_MAX);
|
||||
sem_releaseholder(sem);
|
||||
|
|
Loading…
Reference in New Issue