From fb7d4122fc97be364cf2ce76380b0e5465aba7eb Mon Sep 17 00:00:00 2001 From: qiuyiuestc Date: Thu, 28 Oct 2010 01:21:47 +0000 Subject: implement module memory allocator git-svn-id: https://rt-thread.googlecode.com/svn/trunk@1030 bbd45198-f89e-11dd-88c7-29a3b14d5316 --- src/ipc.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'src/ipc.c') diff --git a/src/ipc.c b/src/ipc.c index 986a39f6a0..96b11410c1 100644 --- a/src/ipc.c +++ b/src/ipc.c @@ -32,6 +32,7 @@ * is RT_IPC_FLAG_PRIO * 2010-01-20 mbbill remove rt_ipc_object_decrease function. * 2010-04-20 Bernard move memcpy outside interrupt disable in mq + * 2010-10-26 yi.qiu add module support in rt_mp_delete and rt_mq_delete */ #include @@ -1228,6 +1229,13 @@ rt_err_t rt_mb_delete (rt_mailbox_t mb) /* resume all suspended thread */ rt_ipc_object_resume_all(&(mb->parent)); +#ifdef RT_USING_MODULE + /* the mb object belongs to an application module */ + if(mb->parent.parent.flag & RT_OBJECT_FLAG_MODULE) + rt_module_free(mb->parent.parent.module_id, mb->msg_pool); + else +#endif + /* free mailbox pool */ rt_free(mb->msg_pool); @@ -1580,10 +1588,17 @@ rt_err_t rt_mq_delete (rt_mq_t mq) /* resume all suspended thread */ rt_ipc_object_resume_all(&(mq->parent)); - /* free mailbox pool */ +#ifdef RT_USING_MODULE + /* the mq object belongs to an application module */ + if(mq->parent.parent.flag & RT_OBJECT_FLAG_MODULE) + rt_module_free(mq->parent.parent.module_id, mq->msg_pool); + else +#endif + + /* free message queue pool */ rt_free(mq->msg_pool); - /* delete mailbox object */ + /* delete message queue object */ rt_object_delete(&(mq->parent.parent)); return RT_EOK; -- cgit v1.3.1