You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by gu...@apache.org on 2021/07/10 19:10:38 UTC

[incubator-nuttx] 01/02: sim: fix loop add delaylist when mm_free in IDLE thread

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

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

commit f5279f85839c0b061186cb677a7ae658f4c0adbf
Author: ligd <li...@xiaomi.com>
AuthorDate: Fri Jul 2 15:22:54 2021 +0800

    sim: fix loop add delaylist when mm_free in IDLE thread
    
    Change-Id: I1827c663275f47c9dc30d63e17e3d016b0000166
    Signed-off-by: ligd <li...@xiaomi.com>
---
 arch/sim/src/sim/up_heap.c | 18 ++++--------------
 1 file changed, 4 insertions(+), 14 deletions(-)

diff --git a/arch/sim/src/sim/up_heap.c b/arch/sim/src/sim/up_heap.c
index 22d6c10..615eb97 100644
--- a/arch/sim/src/sim/up_heap.c
+++ b/arch/sim/src/sim/up_heap.c
@@ -212,21 +212,11 @@ FAR void *mm_malloc(FAR struct mm_heap_s *heap, size_t size)
 FAR void mm_free(FAR struct mm_heap_s *heap, FAR void *mem)
 {
 #if defined(CONFIG_BUILD_FLAT) || defined(__KERNEL__)
-  int ret = (int)getpid();
-
-  /* Check current environment */
-
-  if (up_interrupt_context())
-    {
-      /* We are in ISR, add to mm_delaylist */
-
-      mm_add_delaylist(heap, mem);
-    }
-  else if (ret == -ESRCH || sched_idletask())
+  if (getpid() == -ESRCH)
     {
-      /* We are in IDLE task & can't get sem, or meet -ESRCH return,
-       * which means we are in situations during context switching(See
-       * mm_trysemaphore() & getpid()). Then add to mm_delaylist.
+      /* getpid() return -ESRCH, means we are in situations
+       * during context switching(See mm_trysemaphore() & getpid()).
+       * Then add to mm_delaylist.
        */
 
       mm_add_delaylist(heap, mem);