sim: fix loop add delaylist when mm_free in IDLE thread
Change-Id: I1827c663275f47c9dc30d63e17e3d016b0000166 Signed-off-by: ligd <liguiding1@xiaomi.com>
This commit is contained in:
parent
92210cbdcb
commit
f5279f8583
@ -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())
|
||||
if (getpid() == -ESRCH)
|
||||
{
|
||||
/* We are in ISR, add to mm_delaylist */
|
||||
|
||||
mm_add_delaylist(heap, mem);
|
||||
}
|
||||
else if (ret == -ESRCH || sched_idletask())
|
||||
{
|
||||
/* 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);
|
||||
|
Loading…
Reference in New Issue
Block a user