You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by ma...@apache.org on 2020/09/14 23:50:14 UTC

[incubator-nuttx] branch master updated: mm/mm_heap/mm_initialize.c: add sem lock to mm_addregion()

This is an automated email from the ASF dual-hosted git repository.

masayuki pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new 6b7dd62  mm/mm_heap/mm_initialize.c: add sem lock to mm_addregion()
6b7dd62 is described below

commit 6b7dd62bad80df17f2211618f60f07b3c2c533e2
Author: ligd <li...@xiaomi.com>
AuthorDate: Fri Aug 14 20:43:59 2020 +0800

    mm/mm_heap/mm_initialize.c: add sem lock to mm_addregion()
    
    Change-Id: I4a72e36fcd4504c0d8e671fe2243b14764db3b35
---
 mm/mm_heap/mm_initialize.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/mm/mm_heap/mm_initialize.c b/mm/mm_heap/mm_initialize.c
index fa41069..e49e249 100644
--- a/mm/mm_heap/mm_initialize.c
+++ b/mm/mm_heap/mm_initialize.c
@@ -82,6 +82,8 @@ void mm_addregion(FAR struct mm_heap_s *heap, FAR void *heapstart,
   DEBUGASSERT(heapsize <= MMSIZE_MAX + 1);
 #endif
 
+  mm_takesemaphore(heap);
+
   /* Adjust the provide heap start and size so that they are both aligned
    * with the MM_MIN_CHUNK size.
    */
@@ -127,6 +129,8 @@ void mm_addregion(FAR struct mm_heap_s *heap, FAR void *heapstart,
   /* Add the single, large free node to the nodelist */
 
   mm_addfreechunk(heap, node);
+
+  mm_givesemaphore(heap);
 }
 
 /****************************************************************************