diff options
| author | [email protected] <[email protected]> | 2011-06-12 10:01:48 +0000 |
|---|---|---|
| committer | [email protected] <[email protected]> | 2011-06-12 10:01:48 +0000 |
| commit | 864bd1180237c952beefda21266c3f76f288b99a (patch) | |
| tree | 0d437761b4efee23c50b0a6e88e6a664fd55b2cf /src/mempool.c | |
| parent | 8c3d1e5eaec88d77a2fe623e9d478b9542bad040 (diff) | |
Add reentrance check. Put kernel debug switch together.
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@1494 bbd45198-f89e-11dd-88c7-29a3b14d5316
Diffstat (limited to 'src/mempool.c')
| -rw-r--r-- | src/mempool.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/mempool.c b/src/mempool.c index 5267a98fa1..614512fe0e 100644 --- a/src/mempool.c +++ b/src/mempool.c @@ -182,6 +182,8 @@ rt_mp_t rt_mp_create(const char* name, rt_size_t block_count, rt_size_t block_si struct rt_mempool* mp; register rt_base_t offset; + RT_DEBUG_NOT_REENT + /* allocate object */ mp = (struct rt_mempool*)rt_object_allocate(RT_Object_Class_MemPool, name); if (mp == RT_NULL) return RT_NULL; /* allocate object failed */ @@ -235,6 +237,8 @@ rt_err_t rt_mp_delete(rt_mp_t mp) struct rt_thread* thread; register rt_ubase_t temp; + RT_DEBUG_NOT_REENT + /* parameter check */ RT_ASSERT(mp != RT_NULL); @@ -321,6 +325,8 @@ void *rt_mp_alloc (rt_mp_t mp, rt_int32_t time) } else { + RT_DEBUG_NOT_REENT + /* get current thread */ thread = rt_thread_self(); @@ -363,7 +369,7 @@ void *rt_mp_alloc (rt_mp_t mp, rt_int32_t time) rt_hw_interrupt_enable(level); #ifdef RT_USING_HOOK - if (rt_mp_alloc_hook != RT_NULL) rt_mp_alloc_hook(mp, (rt_uint8_t*)(block_ptr + sizeof(rt_uint8_t*))); + RT_OBJECT_HOOK_CALL2(rt_mp_alloc_hook,mp, (rt_uint8_t*)(block_ptr + sizeof(rt_uint8_t*))); #endif return (rt_uint8_t*)(block_ptr + sizeof(rt_uint8_t*)); @@ -387,7 +393,7 @@ void rt_mp_free (void *block) mp = (struct rt_mempool*) *block_ptr; #ifdef RT_USING_HOOK - if (rt_mp_free_hook != RT_NULL) rt_mp_free_hook(mp, block); + RT_OBJECT_HOOK_CALL2(rt_mp_free_hook,mp, block); #endif /* disable interrupt */ |
